+ Reply to Thread
Results 1 to 5 of 5

Vlookup and IsError producing runtime 1004

  1. #1
    Registered User
    Join Date
    08-01-2011
    Location
    California
    MS-Off Ver
    2007/2010
    Posts
    14

    Vlookup and IsError producing runtime 1004

    I'm trying to lookup a cell value from one worksheet into another one. If the value isn't in the worksheet, I want it to move on to the next nested statement. On the first Vlookup (underlined) function I'm getting an error when it tries to pass the value of L3 into Vlookup and search the sheet "ZBALEVEL3". I can't seem to find anything that will make this work. Any help would be greatly appreciated! THanks!

    Please Login or Register  to view this content.
    Last edited by drinkmorewine; 05-05-2014 at 01:02 AM.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Vlookup and IsError producing runtime 1004

    Instead of passing L3 in Vlookup use Range("L3").value so it would be like this.....

    Please Login or Register  to view this content.
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Vlookup and IsError producing runtime 1004

    Try something like this (not tested)

    Please Login or Register  to view this content.
    Last edited by AlphaFrog; 05-05-2014 at 12:37 AM.
    Surround your VBA code with CODE tags e.g.;
    [CODE]your VBA code here[/CODE]
    The # button in the forum editor will apply CODE tags around your selected text.

  4. #4
    Registered User
    Join Date
    08-01-2011
    Location
    California
    MS-Off Ver
    2007/2010
    Posts
    14

    Re: Vlookup and IsError producing runtime 1004

    Alpha,

    With some minor adjustments (combined all 3 worksheets into 1 and added Step -1 to the for loop) this worked perfectly and condensed my code greatly. What is it about the .Value that worked in the VLookup function?

    Thanks a million.

  5. #5
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: Vlookup and IsError producing runtime 1004

    You're welcome.

    I didn't notice the three worksheets. (It's late and I'm going to bed soon). Glad you adjusted for it.

    What is the lookup value data type? (date, text, numbers). It may have been how you declared the L1, L2, L3 variables (type).

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] IF-Then-Else loop stopping and producing runtime error 1004
    By Optiprime in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-07-2013, 03:24 AM
  2. runtime error 1004
    By caherine in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-22-2012, 04:28 PM
  3. Replies: 0
    Last Post: 05-14-2012, 11:59 PM
  4. VBA vlookup won't find numbers - runtime error 1004
    By wonderdunder in forum Excel General
    Replies: 9
    Last Post: 05-26-2011, 04:53 PM
  5. Need help with VBA Vlookup...keep getting 1004 runtime or code skips
    By John2810 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-05-2010, 06:07 AM

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