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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VLOOKUP IN VBA

Status
Not open for further replies.

nikohl

Programmer
Joined
Mar 13, 2002
Messages
4
Location
CA
Hi there,

I was wondering if there was a VLOOKUP in VBA that I could use? I'm fairly new to VBA so please bear with me. I'll quickly explain what I want to do, just to put you in context. I have two files, a source file and a destination file. The source file has account#'s and data associated to them. The destination file also has account#'s (maybe even some that are in the source file). I want to take a row in the source file, take the first cell (which is the unique account #) and see if this account# exists in the destination file. If it does, add (mathematically) the numbers in other columns in the source to the destination. If it doesn't, simple append the entire row. I know how to append the row, I just don't know how to lookup then add into columns. I also know that there is a function in excel called VLookup than can do this, but I can't find this in VBA. Any help would be greatly appreciated. Thanks in advance.

Nikohl
 
I haven't used excel functions in vba for a while but when I did (xl v7) application.vlookup(params etc) did the trick!

I think the addition of workbookfunction is required in later versions

ie VariableName = Application.WorksheetFunction.VLookup(arg1, arg2, arg3)

Hope this is of some help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top