Reputation: 133
I am creating a VLOOKUP in VBA and it works fine but I am not able to define as "range" only the cells in column A that contain a value. The below line takes into account all column A and its giving me error messages for all the empty cells in the column. Any idea how can I fix the syntax?
Set lookFor = book1.Sheets(1).Range("A3" & LastRow)
Upvotes: 2
Views: 171
Reputation:
Use SpecialCells to locate text and number constants.
Set lookFor = book1.Sheets(1).Range("A1:A" & LastRow).SpecialCells(xlCellTypeConstants, xlNumbers+xlTextValues)
Upvotes: 3