+ Reply to Thread
Results 1 to 6 of 6

Repeating a macro in every row

  1. #1
    Forum Contributor
    Join Date
    06-05-2006
    Posts
    166

    Repeating a macro in every row

    Hi,

    I have simply recorded the following code:

    Please Login or Register  to view this content.
    ...however, I need the macro to work on every active row on sheet1 with the selected cells always moving down one row in each secton with the exception of the pasting on sheet3 which will always need to be in cell H5. When the macro reaches an inactive cell it should end. Any help here would be most appreciated.


    Thanks in advance.

  2. #2
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Repeating a macro in every row

    this would be way easier with a BEFORE/AFTER set of of worksheets to look at, so we know we are matching your intended results.

    can you post a sample?
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Repeating a macro in every row

    This macro will attempt to run your routine on all the rows that have data in column F starting at F5 and going down.

    Please Login or Register  to view this content.
    Last edited by JBeaucaire; 04-30-2009 at 06:35 PM. Reason: Corrected the copy BACK section to values only

  4. #4
    Forum Expert
    Join Date
    01-03-2006
    Location
    Waikato, New Zealand
    MS-Off Ver
    2010 @ work & 2007 @ home
    Posts
    2,243

    Re: Repeating a macro in every row

    hi,

    I agree with JB, that this would be much easier with an example workbook (these can be uploaded using the Paperclip or the Manage Attachment button). Also, I suspect there could be an easier/faster (depending on size of data set) way to achieve the same results without modifying two sheets "line by line".

    Here is a slightly modified version of JB's code which will remove the risk* of accidental changing/clearing of the clipboard (eg pressing [ctrl + c], or [Esc]. *(if concurrently working in another application) - of course this isn't likely to be a problem if you just kick back or go & get a coffee while your macro is running.

    Please Login or Register  to view this content.
    hth
    Rob
    Rob Brockett
    Kiwi in the UK
    Always learning & the best way to learn is to experience...

  5. #5
    Forum Contributor
    Join Date
    06-05-2006
    Posts
    166

    Re: Repeating a macro in every row

    Thank you all for your help. JB's code works just as I needed. You have literally saved me hours of work. Thank you very much.

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Repeating a macro in every row

    My pleasure, that's what we hope for!

    If that takes care of your need, be sure to EDIT your original post (Go Advanced) and mark the PREFIX box [SOLVED].

    (Also, click on the "balance scales" icon across from the date on my post to leave Feedback, it is appreciated)

+ 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