Enter formula by code.

F

Francis Brown

Hi All

can anyone help. I cant seem to get this to work.

I keep getting run time error 1004

application or object defined error.

Public Sub TLIdentify()

finalrow = Worksheets("INV Bookings").Range("B65536").End(xlUp).Row

Worksheets("INV Bookings").Range("AV26:AV" & finalrow).FormulaR1C1 =
"=IF(OR(RC[-38]>0,RC[-32]>0,RC[-26]>0,RC[-20]>0,RC[-14]>0,RC[-8]>0,RC[-2]>0),VLOOKUP(RC4,'Team Summary'!R4C3:R16C4,2,0),"")"

End Sub
 
L

Lars-Åke Aspelin

Hi All

can anyone help. I cant seem to get this to work.

I keep getting run time error 1004

application or object defined error.

Public Sub TLIdentify()

finalrow = Worksheets("INV Bookings").Range("B65536").End(xlUp).Row

Worksheets("INV Bookings").Range("AV26:AV" & finalrow).FormulaR1C1 =
"=IF(OR(RC[-38]>0,RC[-32]>0,RC[-26]>0,RC[-20]>0,RC[-14]>0,RC[-8]>0,RC[-2]>0),VLOOKUP(RC4,'Team Summary'!R4C3:R16C4,2,0),"")"

End Sub

You have to double your "s in the end of the IF statement.
As the formula is inside a long string a single " will be interpreted
as the end of this string rather than a " that is to be part of the
formula.

Change you formula like this:

......R16C4,2,0),"""")"

and say good bye to the error 1004 :)

Hope this helps / Lars-Åke
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top