View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
u473 u473 is offline
external usenet poster
 
Posts: 184
Default VLookUp Syntax Error ?

I pasted in a new module the following code from Patrick Molloy
in this group and the line
myformula ="=IF(ISERROR...... was immediately highlighted in Error.
I did not bother in this first try to Dim my variables.
I did not think that would generate an error.
Which raises this question : Are there any potential triggered errors
before code run ? For instance, a Keyword not existing in my
Visual Basic Version ? What did I miss ?

Sub LookupFill()
FirstRow = 20
LastRow = 70
WhichCol = "K"

myformula ="=IF(ISERROR(VLOOKUP(C[1],Sheet1!RC"[-1]: _
R[155]C,2,0),"",VLOOKUP(C[1], _
Sheet1!RC[-1]:R[155]C,2,0))"

With Range(Cells(Firstrow,WhichCol), _
Cells(Lastrow,WhichCol))

.Formular1C1 = myformula

End With
End Sub

Thank you for your help
Wayne