+ Reply to Thread
Results 1 to 5 of 5

Vllokup

  1. #1
    Forum Contributor
    Join Date
    08-20-2005
    Posts
    171

    Vllokup

    Table is a name I have defined,
    the following is my vlookup with which I get object-defined error,

    many Thanks

    Sub test()

    Cells(2, 9) = WorksheetFunction.VLookup(Cells(2, 7), Table, 2, 0)


    End Sub

  2. #2
    NickHK
    Guest

    Re: Vllokup

    VBA does not know what Table means. You have to tell it that it is a Range.
    Cells(2, 9) = WorksheetFunction.VLookup(Cells(2, 7), Range(Table), 2, 0)

    Be careful of which sheet these Cells/Range objects are pointing to.

    NickHK

    "T De Villiers" <[email protected]>
    wrote in message
    news:[email protected]...
    >
    > Table is a name I have defined,
    > the following is my vlookup with which I get object-defined error,
    >
    > many Thanks
    >
    > Sub test()
    >
    > Cells(2, 9) = WorksheetFunction.VLookup(Cells(2, 7), Table, 2, 0)
    >
    >
    > End Sub
    >
    >
    > --
    > T De Villiers
    > ------------------------------------------------------------------------
    > T De Villiers's Profile:

    http://www.excelforum.com/member.php...o&userid=26479
    > View this thread: http://www.excelforum.com/showthread...hreadid=566961
    >




  3. #3

    Re: Vllokup

    Hi
    Try
    Cells(2, 9) = WorksheetFunction.VLookup(Cells(2, 7), "Table", 2, FALSE)

    The range name must be in quotes.
    regards
    Paul

    T De Villiers wrote:
    > Table is a name I have defined,
    > the following is my vlookup with which I get object-defined error,
    >
    > many Thanks
    >
    > Sub test()
    >
    > Cells(2, 9) = WorksheetFunction.VLookup(Cells(2, 7), Table, 2, 0)
    >
    >
    > End Sub
    >
    >
    > --
    > T De Villiers
    > ------------------------------------------------------------------------
    > T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
    > View this thread: http://www.excelforum.com/showthread...hreadid=566961



  4. #4

    Re: Vllokup

    oops - should be Range("Table") in VBA.
    regards
    Paul

    [email protected] wrote:
    > Hi
    > Try
    > Cells(2, 9) = WorksheetFunction.VLookup(Cells(2, 7), "Table", 2, FALSE)
    >
    > The range name must be in quotes.
    > regards
    > Paul
    >
    > T De Villiers wrote:
    > > Table is a name I have defined,
    > > the following is my vlookup with which I get object-defined error,
    > >
    > > many Thanks
    > >
    > > Sub test()
    > >
    > > Cells(2, 9) = WorksheetFunction.VLookup(Cells(2, 7), Table, 2, 0)
    > >
    > >
    > > End Sub
    > >
    > >
    > > --
    > > T De Villiers
    > > ------------------------------------------------------------------------
    > > T De Villiers's Profile: http://www.excelforum.com/member.php...o&userid=26479
    > > View this thread: http://www.excelforum.com/showthread...hreadid=566961



  5. #5
    Robert Bruce
    Guest

    Re: Vllokup

    Roedd <<T De Villiers>> wedi ysgrifennu:

    > Table is a name I have defined,
    > the following is my vlookup with which I get object-defined error,
    >
    > many Thanks
    >
    > Sub test()
    >
    > Cells(2, 9) = WorksheetFunction.VLookup(Cells(2, 7), Table, 2, 0)
    >
    >
    > End Sub




    At a guess:

    Cells(2, 9) = WorksheetFunction.VLookup(Cells(2, 7), Range("Table"), 2, 0)

    HTH

    Rob



+ 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