+ Reply to Thread
Results 1 to 3 of 3

Returning to a Relative Starting Point

  1. #1
    Registered User
    Join Date
    01-21-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Returning to a Relative Starting Point

    Hello,

    My explanation of what I want is a bit confusing so I'm hoping someone can understand.

    I am trying to create a looping vlookup macro. So in cell B1, there is a vlookup formula that will loop until the cell to the left (A1) is blank. Once completed, I would want it to move to C1 (with another vlookup formula I have entered) and loop until A1 is blank again.

    Each time I run the macro, the number of data rows vary so sometimes it will have 10 sets of data, sometimes 100 sets of data. Therefore, I want it to return to the relative starting point "B1" and then move 1 cell to the right (C1) and have the second formula triggered. Also, I want to trigger the vlookup macro anywhere, for instance if I trigger it in cell D3, I would want it to loop and then go to E3. I know how to do this using absolute points but how do I get it to return to the relative starting point?

    Thank you!
    Last edited by dkim.ags; 01-21-2013 at 08:40 PM.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Returning to a Relative Starting Point

    To Attach a workbook (with macro code):
    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the Browse... button to locate your file for uploading.
    6. This will open a new window File Upload.
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the Upload button and wait until the file has uploaded.
    10. Close the window and then click Submit
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    01-21-2013
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Re: Returning to a Relative Starting Point

    Here is my code:

    Please Login or Register  to view this content.
    So no matter where I click on the spreadsheet and trigger the macro, this will run a vlookup until the cell to the left is empty. Now I want the "cursor" (to select the cell) on the right of where I originally started my first macro and run another vlookup and runs until 2 cells to the left are empty.

    Please Login or Register  to view this content.
    Each time I use the macro, the number of rows differ so I want to see if there is a way for the cursor to return to the original starting point of the first vlookup and then move 1 to the right to run the second macro.
    Last edited by jeffreybrown; 01-22-2013 at 02:50 PM. Reason: Please use code tags...Thanks.

+ 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