Closed Thread
Results 1 to 6 of 6

Vlookup using VBA

  1. #1
    Forum Contributor
    Join Date
    08-22-2013
    Location
    columbus,oh
    MS-Off Ver
    Office 365
    Posts
    190

    Vlookup using VBA

    I have a vba code that I am working on and my challenge is that after I open all the files I need and write the VBA code I am specifying a cell where that vlookup is:
    This is what I have :

    HTML Code: 
    This brings in the vlookup in AF2 and AG2 Now i need it to find the last row and copy the formula down to all the cells.
    How can I do that? Ideally I dont want to specify a ending row like i have done in the formula since it will give #N/A on extra empty rows.

    Thanks for your help!
    Last edited by pdalal; 01-28-2015 at 10:25 AM.

  2. #2
    Forum Contributor
    Join Date
    08-22-2013
    Location
    columbus,oh
    MS-Off Ver
    Office 365
    Posts
    190

    Re: Vlookup using VBA

    Code Tags applied

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vlookup using VBA

    pdalal,
    You don't want to specify an ending row because of empty rows... but what if you use a variable for the last row? Then you can assign that variable the value of the last row with data, and used that row in your code. The code line below would find the last row that has data in it, change sheet name to the right one, and change the column (A) to whatever column would be populated.

    Please Login or Register  to view this content.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Forum Contributor
    Join Date
    08-22-2013
    Location
    columbus,oh
    MS-Off Ver
    Office 365
    Posts
    190

    Re: Vlookup using VBA

    how would I put that in my vlookup to copy all the way down in range AF and AG and also add if is NA then just leave as ""

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Vlookup using VBA

    lets stick to one thread... I've replied in the other, which had other activity, so I'll stay on that one and abandon this one.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,924

    Re: Vlookup using VBA

    Welcome to the Forum, unfortunately:

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 12-04-2014, 01:27 PM
  2. Replies: 0
    Last Post: 12-26-2013, 01:12 PM
  3. Display Cell within VLookup range that excel thinks matches the VLookup Value
    By headachexcelperson in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-04-2013, 04:56 PM
  4. vlookup? match? index? MULTIPLE criteria for vlookup search problem....
    By aborg88 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-11-2013, 09:56 AM
  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