View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Syntax Error in VLOOKUP Code

Welcome back!

--
Regards,
Tom Ogilvy

"Ken" wrote in message
...
Thanks, Tom.
Been a while since I was on this newsgroup and thought I was at the "wrong
house" at first. Glad you are still here helping!

"Tom Ogilvy" wrote:

Assume FileOpenName850 is like "myfile.xls" and not
"C:\Myfolder\Myfile.xls"

You don't specify which worksheets, so assume the first

Dim rng as Range
Set rng = Workbooks(FileOpenName850).worksheets(1).Range("A1 :C" &
NumRowsF850)
For ILoop = NumRowsIFCAP to 1 Step -1
if iserror(Application.Vlookup(Cells(ILoop,1),rng,2,F alse)) then

--
Regards,
Tom Ogilvy





IF(ISERROR(VLOOKUP(Cells(Iloop,1),FileOpenNameF850 !$A$1:$C$NumRowsF850,2,FAL
SE)))
"Ken" wrote in message
...
I have the following code as part of a larger macro.

For ILoop = NumRowsIFCAP To 1 Step -1



IF(ISERROR(VLOOKUP(Cells(Iloop,1),FileOpenNameF850 !$A$1:$C$NumRowsF850,2,FAL
SE))) then
(More code...)
End If
Next Iloop

"FileOpenNameF850" is a string variable that holds a workbook name

that
contains one worksheet.

I can't get the syntax correct in the VLOOKUP line of code. What is

the
correct syntax?

TIA.