+ Reply to Thread
Results 1 to 6 of 6

IFERROR w/vlookup in VBA

  1. #1
    Registered User
    Join Date
    09-25-2013
    Location
    Phoenix
    MS-Off Ver
    Excel 2007
    Posts
    61

    IFERROR w/vlookup in VBA

    I'm having trouble getting an iferror function to work in VBA. The function works fine when entered in the cell itself, but i would like it to run with my sub so i don't have to manually drag down the function.

    Please Login or Register  to view this content.
    above is my code. The iferror is looking across 5 other sheets: IDO_supplier, Clear_assy, etc. I would like it to populate in the ALLmissed sheet. when i run it, i am getting an object defined error.

    appreciate any help!

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: IFERROR w/vlookup in VBA

    Double up any quotes within the formula:

    This:

    Please Login or Register  to view this content.

    becomes this:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    09-25-2013
    Location
    Phoenix
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: IFERROR w/vlookup in VBA

    Thanks for the fast response TMS. I'm having one more issue now. The cell that im searching (D2) is staying consistent, but i would like for it to search for the cell which row it is in. So $D2 was just the first row. Is there a way to have that change to search the cell in column D of the current row each time? Like it does when I enter the function and manually drag down in the actual sheet?

    Thanks again!

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: IFERROR w/vlookup in VBA

    Two ways to do it.

    1) use R1C1 rather than A1 format

    2) change all the $D2 references to: $D" & index & ". So, you're actually changing the 2 to " & index & "


    Regards, TMS

  5. #5
    Registered User
    Join Date
    09-25-2013
    Location
    Phoenix
    MS-Off Ver
    Excel 2007
    Posts
    61

    Re: IFERROR w/vlookup in VBA

    Thanks a ton!

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,422

    Re: IFERROR w/vlookup in VBA

    You're welcome. Thanks for the rep.

+ 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] VLOOKUP - need to do something with IFERROR in there too???
    By BHammy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-19-2013, 07:10 PM
  2. [SOLVED] Using Iferror(vlookup..) in VBA
    By sn79 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-18-2013, 02:40 PM
  3. Vlookup with iferror in vba
    By arlu1201 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-23-2012, 11:48 AM
  4. IFERROR With VLOOKUP
    By Badvgood in forum Excel General
    Replies: 2
    Last Post: 05-11-2011, 09:27 AM
  5. Excel 2007 : Vlookup and iferror help soon...
    By MRKINGSTON1976 in forum Excel General
    Replies: 1
    Last Post: 10-28-2009, 03:21 PM

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