+ Reply to Thread
Results 1 to 5 of 5

Need code to enter the last cell when using VLOOKUP

  1. #1
    Registered User
    Join Date
    08-20-2012
    Location
    Norfolk, Canada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Need code to enter the last cell when using VLOOKUP

    I need the following code modified so the lookup range is dynamic. The next file may not be the same size.
    The first line is how it appears in the cell.
    The second line is in the VBA code.
    All data will be in columns A and B but the number of rows changes.

    Please Login or Register  to view this content.

  2. #2
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Need code to enter the last cell when using VLOOKUP

    Try

    Please Login or Register  to view this content.
    HTH
    Regards, Jeff

  3. #3
    Registered User
    Join Date
    08-20-2012
    Location
    Norfolk, Canada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Need code to enter the last cell when using VLOOKUP

    The code you provided limited the lookup to two rows from A1 to B2. I expected a range from A1 to B356 which is the required data set to scan.

  4. #4
    Forum Expert JapanDave's Avatar
    Join Date
    06-10-2008
    Location
    The grid, I got in!
    MS-Off Ver
    Excel 2010/13
    Posts
    1,696

    Re: Need code to enter the last cell when using VLOOKUP

    Footley, Not to step on Jeffs toe's (he certainly can give the same answer), but Jeff's code is sound, it will dynamically change the range to suit.
    Do you only have two rows with data in them in column A an the worksheet you ran the code on?
    Be fore warned, I regularly post drunk. So don't take offence (too much) to what I say.
    I am the real 'Napster'
    The Grid. A digital frontier. I tried to picture clusters of information as they moved through the computer. What did they look like? Ships? motorcycles? Were the circuits like freeways? I kept dreaming of a world I thought I'd never see. And then, one day...

    If you receive help please give thanks. Click the * in the bottom left hand corner.

    snb's VBA Help Files

  5. #5
    Forum Moderator jeffreybrown's Avatar
    Join Date
    02-19-2009
    Location
    Cibolo, TX
    MS-Off Ver
    Office 365
    Posts
    10,316

    Re: Need code to enter the last cell when using VLOOKUP

    @JapanDave -- the more help the merrier

    @Footley,
    My fault, should have qualified the LR variable as you most likely ran this code from a sheet other than the Order tab. In this case, if the LR variable is not qualified then the LR was taken from the active sheet.

    This should be more accurate

    Please Login or Register  to view this content.
    Last edited by jeffreybrown; 08-25-2012 at 08:27 AM.

  6. #6
    Registered User
    Join Date
    08-20-2012
    Location
    Norfolk, Canada
    MS-Off Ver
    Excel 2007
    Posts
    12

    Re: Need code to enter the last cell when using VLOOKUP

    Thanks for your input. I should have said the lookup data was not on the same tab. The whole process I'm building is to take information from SAP to Excel, build a file that can then be loaded into MS Project with a minimum of manual computer time. I'm now two steps closer after joining this forum.

    Thanks to others for viewing my request.

+ 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