+ Reply to Thread
Results 1 to 3 of 3

Macro repeats and then stops

  1. #1
    Sabba Efie
    Guest

    Macro repeats and then stops

    I have two columns of data. I have written a macro to operate on the data
    from the first column (i.e. copy, paste, move cursor, etc.). I want that
    macro to repeat for the data in column 1 as long as there is data in column
    2. When a blank cell in column 2 is reached the macro should stop.

  2. #2
    Don Guillett
    Guest

    Re: Macro repeats and then stops

    as ALWAYS, post your code for comments but something along this idea
    lr=cells(rows.count,2).end(xlup).row
    for i=2 to lr
    do your thing
    next i

    --
    Don Guillett
    SalesAid Software
    [email protected]
    "Sabba Efie" <[email protected]> wrote in message
    news:[email protected]...
    >I have two columns of data. I have written a macro to operate on the data
    > from the first column (i.e. copy, paste, move cursor, etc.). I want that
    > macro to repeat for the data in column 1 as long as there is data in
    > column
    > 2. When a blank cell in column 2 is reached the macro should stop.




  3. #3
    Trevor Shuttleworth
    Guest

    Re: Macro repeats and then stops

    One way:

    i = 1
    Do While Range("B" & i) <> ""
    MsgBox Range("A" & i).Value
    ' Replace the MsgBox line above with a call to your macro
    ' For example:
    ' YourMacro
    i = i + 1
    Loop

    Regards

    Trevor


    "Sabba Efie" <[email protected]> wrote in message
    news:[email protected]...
    >I have two columns of data. I have written a macro to operate on the data
    > from the first column (i.e. copy, paste, move cursor, etc.). I want that
    > macro to repeat for the data in column 1 as long as there is data in
    > column
    > 2. When a blank cell in column 2 is reached the macro should stop.




+ 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