+ Reply to Thread
Results 1 to 4 of 4

how to use a VLOOKUP function in a VBA code?

  1. #1
    Sunil
    Guest

    how to use a VLOOKUP function in a VBA code?

    Hi
    am a novice in excel...i have a excel sheet with 2 columns with around 10000
    records.i have placed a button in the excel sheet and on clicking the button
    it should find all the values in the first column which doesnt have a match
    in the second column.for that i can use VLOOKUP function.but i dont know how
    to use that one.
    Can any one help me?

    Thanks in advance....

    With Regds

    Sunil.T

  2. #2
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    WorksheetFunctions.Vlookup()

    The arguments are similar

    Mangesh

  3. #3
    Sunil
    Guest

    RE: how to use a VLOOKUP function in a VBA code?

    Hi,

    i tried ..but am getting some errors...it will be very helpful for me if
    u send me the syntax regarding my req.Thanks in advance

    With regds
    Sunil.T
    "Sunil" wrote:

    > Hi
    > am a novice in excel...i have a excel sheet with 2 columns with around 10000
    > records.i have placed a button in the excel sheet and on clicking the button
    > it should find all the values in the first column which doesnt have a match
    > in the second column.for that i can use VLOOKUP function.but i dont know how
    > to use that one.
    > Can any one help me?
    >
    > Thanks in advance....
    >
    > With Regds
    >
    > Sunil.T


  4. #4
    Forum Contributor
    Join Date
    06-10-2004
    Location
    India
    Posts
    1,066
    Hi Sunil,

    Here's an example:

    Private Sub CommandButton1_Click()

    Set myRng = Worksheets("Sheet1").Range("A1:B10")
    myLookup = 4

    myValue = WorksheetFunction.VLookup(myLookup, myRng, 2)

    End Sub


    The table is A1:B10.
    myLookup is the lookup_value which would be in column A. myValue is the value corresponding to the myLookup as returned by the above formula.
    2 is the column index number which tells the lookup to look for the result in the second column of the table A1:B10 i.e. column B


    Mangesh

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1