+ Reply to Thread
Results 1 to 8 of 8

Looping Copy/Paste Macro

  1. #1
    Registered User
    Join Date
    01-12-2010
    Location
    Tampa
    MS-Off Ver
    Excel 2008
    Posts
    5

    Looping Copy/Paste Macro

    Hi all,

    I'd like to create a macro that copies one cell of a range, pastes that cell on another sheet, then clears the cell pasted into. Takes the next cell in the range, and then copies it into that same cell previously used.

    For example this would be the operation, I'm just not sure how I could get it to loop.

    Please Login or Register  to view this content.
    Thanks for any help!

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: New to VBA, Help with looping Copy/Paste Macro

    Hi yuuuh
    I'd like to create a macro that copies one cell of a range, pastes that cell on another sheet, then clears the cell pasted into. Takes the next cell in the range, and then copies it into that same cell previously used.
    OK, I'll bite. You're copying a cell, pasting, deleting the paste, copying a cell, pasting, deleting the paste, etc, etc, etc.. Correct?
    Why? What's the purpose? It'll help if I know your end goal.
    John
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    01-12-2010
    Location
    Tampa
    MS-Off Ver
    Excel 2008
    Posts
    5

    Re: New to VBA, Help with looping Copy/Paste Macro

    Exactly. The cell being pasted into is referenced in an equation, so when the new paste occurs, a value changes. I would like to be able to control when the next copy occurs via a key, so that the value can be observed. Not sure if that makes sense, basically to see the impacts of user defined values on an equation.
    Last edited by teylyn; 01-22-2010 at 07:14 PM. Reason: removed spurious quote

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Looping Copy/Paste Macro

    Hi yuuuh
    OK, that makes some sense. I think I can help you with this. However, if you could post some sample data with the results, it'll help me see if things are calculating correctly. Not a "must" just may save some aggravation
    John

  5. #5
    Registered User
    Join Date
    01-12-2010
    Location
    Tampa
    MS-Off Ver
    Excel 2008
    Posts
    5

    Re: Looping Copy/Paste Macro

    For sure, here's a simple sample.
    Attached Files Attached Files
    Last edited by teylyn; 01-22-2010 at 07:14 PM. Reason: removed spurious quote

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Looping Copy/Paste Macro

    Hi yuuuh
    Try this code
    Please Login or Register  to view this content.
    Let me know of issues
    John

  7. #7
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Looping Copy/Paste Macro

    yuuuh, please don't quote whole posts. It's just clutter.

  8. #8
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Looping Copy/Paste Macro

    Hello yuuuh,

    You should read about Scenarios in Excel. Scenarios allow you to select specific cells to be changed and observe the results on the remaining data.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ 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