By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,061 Members | 1,539 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,061 IT Pros & Developers. It's quick & easy.

vlookup in visual basic

P: n/a
could someone tell me the correct syntax for using vlookup
in visual basic
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

"Rebecca" <an*******@discussions.microsoft.com> wrote in message
news:79****************************@phx.gbl...
could someone tell me the correct syntax for using vlookup
in visual basic


VLOOKUP is an Excel worksheet function. I've never heard of it existing in
VB. Could you provide more details on what you're trying to do?
Nov 20 '05 #2

P: n/a
It says in the help that vlookup can be used in visual
basic, what I am actually doing is in the spreadsheet
looking to the top of the column reading C2 then going to
another spreadsheet and finding that value and giving the
value in the col next to it, as vlookup does in excel.
Then if it is the same a macro starts which deletes the
original row and moves the rest of the table along. I
tried to do it in excel but once the macro has run the
cell reference for C2 is lost, so I thought I could try it
in a macro. Any ideas?
-----Original Message-----

"Rebecca" <an*******@discussions.microsoft.com> wrote in messagenews:79****************************@phx.gbl...
could someone tell me the correct syntax for using vlookup in visual basic
VLOOKUP is an Excel worksheet function. I've never heard

of it existing inVB. Could you provide more details on what you're trying to do?

.

Nov 20 '05 #3

P: n/a

<an*******@discussions.microsoft.com> wrote in message
news:79****************************@phx.gbl...
It says in the help that vlookup can be used in visual
basic,


"The help"? The help for Excel? If that is what you mean, then it's
referring to the fact that you can access this function (and any worksheet
function) from VBA. If you are indeed writing in VBA (i.e., creating a macro
from within Excel itself) then you'd be much better served by asking in the
proper group. I recommend microsoft.public.excel.programming.
Nov 20 '05 #4

P: n/a
Rebecca,

You can use just about any Excel function in VB. You must first include the
Microsoft Excel 9.0 Object Library reference in your application.

Assuming you already created an Excel object and have a reference to a
particular sheet, the syntax for VLookup is

sFound = Application.Worksheetfunction.VLookup(sWhatToLookF or,
WorksheetIdentification.Worksheets("sheetName" or #).Range(Range to look in)

Any of the Worksheet functions are available through the Worksheetfunction.

the WorksheetIdentification is the variable you assigned to the worksheet
you are working on.

Hope this helps

Gary

"Rebecca" wrote:
could someone tell me the correct syntax for using vlookup
in visual basic

Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.