+ Reply to Thread
Results 1 to 3 of 3

vlookup and looping vba

  1. #1
    Registered User
    Join Date
    08-08-2014
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010-2013
    Posts
    31

    Unhappy vlookup and looping vba

    Hey everyone,

    Still trying to get the hang of VBA. I have a set of customer accounts that I need to pull the state in using vlookup. The thing is the customer accounts list is dynamic and changes every week (nfile - 20,000+ lines) and the master file I pull the states from is dynamic and changes every week ( ZCIS.xlsx - 1,000,000+ lines). I am trying to figure out how to speed up my vlookup using a next i or loop construct. Dim nfile allows me to use input date to enter in the date of the file each week since the customer accounts format never changes, simply the date we are looking at the open customer accounts. ZCIS is the customer master file that contains the state I am trying to pull-in. My previous code used a simple .formula and LastRow.filldown.

    Please Login or Register  to view this content.
    This is my current failed attempt at the do loop construct

    Please Login or Register  to view this content.
    Any help is greatly appreciated, also let me know if I am approaching the speed issue from the wrong angle. Thanks!

    Kyle

  2. #2
    Forum Expert
    Join Date
    10-09-2014
    Location
    Newcastle, England
    MS-Off Ver
    2003 & 2013
    Posts
    1,986

    Re: vlookup and looping vba

    Im probably being dim but you set the last row in variable LastRow2 but then use LastRow in your For loop, shouldnt that be

    Please Login or Register  to view this content.
    or are you setting LastRow elsewhere in the code?

  3. #3
    Registered User
    Join Date
    08-08-2014
    Location
    Dallas, TX
    MS-Off Ver
    Excel 2010-2013
    Posts
    31

    Re: vlookup and looping vba

    To recap, I have a set of customer accounts that I need to pull the state in using vlookup. One file (nfile) is my customer numbers and their accounts receivable information (typically 20,000+ lines) and the file that has the state(s) listed is the customer master (ZCIS.xlsx - currently at 1,023,128 lines). I need figure out how to speed up my vlookup using a next i or loop construct.

    Please Login or Register  to view this content.
    Unfortunately I keep getting method 'range' of object'_global failed. Any tips what I might be doing wrong? Thanks!

    Kyle
    Last edited by davidktilley; 11-11-2014 at 05:56 PM. Reason: clarification

+ 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] Looping a Vlookup in a range
    By bakeraj256 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-16-2014, 10:52 AM
  2. [SOLVED] VBA for looping VLookup to last row with data
    By AWM1966 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-15-2012, 07:17 AM
  3. looping (like vlookup)
    By Kooper in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-20-2012, 07:42 PM
  4. dynamic looping vlookup
    By dabrows in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-11-2011, 05:00 PM
  5. Replies: 5
    Last Post: 07-29-2009, 07:53 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