+ Reply to Thread
Results 1 to 3 of 3

WorksheetFunction.lookup

  1. #1
    Registered User
    Join Date
    12-19-2007
    Posts
    24

    WorksheetFunction.lookup

    Hello,

    I'm trying to use WorksheetFunction.lookup in some VBA code. I can get the following to work

    Please Login or Register  to view this content.
    It also works if I reference a single cell like below

    Please Login or Register  to view this content.
    It looks for the word ODD in column AP and gives me whats in column AN if it finds a match. However, If I try to switch out the string ODD with a cell it gives me the following error (Run-time error '1004'

    So if I try to switch it out for a cell value like below

    Please Login or Register  to view this content.
    I get the error. ct is just a counter which normally works when using Range.

    I know that the counter is fine because I am using it in the same block of code. Is there a way I can use a variable with WorksheetFunction.lookup?

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: WorksheetFunction.lookup

    Is it declared as a Long? What is its value when the code fails?
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    12-19-2007
    Posts
    24

    Re: WorksheetFunction.lookup

    Quote Originally Posted by shg View Post
    Is it declared as a Long? What is its value when the code fails?
    ct is an Integer

    Your statement made me go back and look at the debugger, it appears to be crashing on a specific cell about 70 rows in.

    I'll have to do some more troubleshooting.

+ 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