+ Reply to Thread
Results 1 to 7 of 7

Macro inserting Vlookup issue

  1. #1
    Registered User
    Join Date
    05-13-2009
    Location
    Wpg
    MS-Off Ver
    Excel 2007
    Posts
    5

    Question Macro inserting Vlookup issue

    Hi there -

    I am trying to insert a Vlookup function within a macro. The macro finds all cells in a column without an entry an replaces a vlookup formula in the cell. However, i need the vlookup formula to lookup a cell in the blank cell's row. eg: =vlookup(b"current row",a1:d100,4,false) but i do not know how to make the vlookup only use the cell's current row with a different column. I have tried to embed the row() function but it doesnt seem to work. Any help would be greatly appreciated.

    Thanks!

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: Macro inserting Vlookup issue

    Hi cgg,

    Post back re how the following goes:

    Please Login or Register  to view this content.
    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    05-13-2009
    Location
    Wpg
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macro inserting Vlookup issue

    I Guess im not sure how to incorporate that with the find and replace function, as it places the vlookup directly into the spreadsheet. I dont believe the active cell will work to replace the blank cells and pull up the correct row. Im not sure how to go about coding it into VBA or if there is a way to just place the correct formula into the spreadsheet.

    Thanks!

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: Macro inserting Vlookup issue

    Could you please post a workbook with a before and after scenario as I'll then be in a better position to understand what you're after.

  5. #5
    Registered User
    Join Date
    05-13-2009
    Location
    Wpg
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macro inserting Vlookup issue

    The example spreadsheet attached shows what is needed. In worksheet X column I, a find and replace will be done where it will find blank cells and replace them with this function:

    VLOOKUP(B10,'Daily Unload'!A2:H17,7,FALSE)

    where the "10" in "B10" needs reflects the row of the current cell when the replace is run. Im not sure how this should be coded on the spreadsheet or in the vba code.

    I hope this helps!

    Thanks for your help!
    Attached Files Attached Files

  6. #6
    Registered User
    Join Date
    05-13-2009
    Location
    Wpg
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Macro inserting Vlookup issue

    Here is the attachment for the previous post -
    Attached Files Attached Files

  7. #7
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,527

    Re: Macro inserting Vlookup issue

    I don't have Excel 2007 at home

    Don't know how many rows you're talking about but the following will do the job if the dataset is not too large:

    Please Login or Register  to view this content.
    HTH

    Robert
    Last edited by Trebor76; 05-23-2009 at 01:02 AM. Reason: Added potential solution

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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