Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel - using vlookup in a loop.

Status
Not open for further replies.

MuskyMan

Technical User
Jul 31, 2002
36
US
Having "Compile error sub or function not defined" when running the code below. For sakes of space, I've just pasted the problem area..

Do While Cells(r, 1) <> Empty
Cells(r, 9).Value = Mid(Cells(r, 1), 20, 11)
Cells(r, 10).Value = VLookup(Cells(r, 9).Value, ElecBud, 4)
r = r + 1
Loop

I'm not sure i know what or how to define what is missing.

Thanks in advance for the help..
 
MuskyMan,

Change the third line to read:
Cells(r, 10).Value = Application.WorksheetFunction.VLookup(Cells(r, 9).Value, ElecBud, 4)
This should fix the problem above.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top