View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
FurRelKT FurRelKT is offline
external usenet poster
 
Posts: 42
Default Help understanding Variables in an IF/VLOOKUP statement

Hello, newbe here...
I need to understand why i can't use this? Inside the
[VLOOKUP(Cells(i,16)]??? What can i use there? Any help would be most
appreciated.

here is the code i have so far...

Sub fillformat ()
Dim FinalRow As Long
FinalRow = Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To FinalRow
If Cells(i, 2).Value = "SUP" Then
Cells(i, 7).Clear
Cells(i, 7) = Left(Cells(i, 4), 5)
myvar = Cells(i, 7).Value
Cells(i, 16).Value = myvar
Cells(i, 7).Clear
Cells(i, 7).Formula =
"=IF(VLOOKUP(Cells(i,16),ClientList,1,False)" _
& ", ""ERROR"",VLOOKUP(Cells(i,16),ClientList,1,False)) "


End If
End Sub

Thank you so much.
Keri