+ Reply to Thread
Results 1 to 8 of 8

copying cells with a macro

  1. #1
    Registered User
    Join Date
    10-09-2009
    Location
    Lloydminster, Sk
    MS-Off Ver
    Excel 2007
    Posts
    10

    copying cells with a macro

    I would like to copy a range of cells with a marcro, for example copying range C3:C15 over to D3:D15 and when I run the macro again I want range D3:D15 to copy to E3:E15 and from there to copy E3:E15 to F3:F15. I want to keep that going to the next and the next with the same macro. But it just keeps copying the the original range which I recorded in the macro, but I want it to keep going. If somebody can help me with that, I would sure appreciate hearing from you.
    Thanks
    Last edited by miketsch; 10-12-2009 at 11:01 AM.

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

    Re: copying cells with a macro

    Hello miketsch,

    Welcome to the Forum!

    A good starting point would be to see your recorded macro. To make your posts easier to read, copy, and edit please wrap your code.

    How to wrap your Code
    1. Select all your code using the mouse.
    2. Click on the # icon on the toolbar in the Message window. This will automatically wrap the text you selected with the proper Code tags to create a Code Window in your post.

    Use the Bulletin Board Code Tags
    [code]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/code] at the end of the last line.


    To learn more about BB codes used in this forum, just click on the link below...

    Bulletin Board Codes Tags
    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!)

  3. #3
    Registered User
    Join Date
    10-09-2009
    Location
    Lloydminster, Sk
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: copying cells with a macro

    Thanks for your reply. I assume this is what you would like to see.

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: copying cells with a macro

    I'm having a hard time visualising what you are trying to get out of this. I ran the recorded macro you provided and it copied the cells you wanted, but then placed a date a the top of that data and then removed the data. Only thing that was left was the data in Column R and a date at the top of column S.

    Are you trying to shift data to the right so you can input new data? Are you retaining any data in the columns you are copying to? Are you trying to move a column of data to a spot of your liking (running over any data that might be in it's way)? Need a little more information plz.
    Janos S. Vamos
    Data Systems Technician/Fire Controlman PO1(SW/AW)
    US Navy Retired


    Remember, Record Macro can be your friend for figuring out solutions.

    Good or Bad, let me know how I did by clicking on the "Add Reputation" * just to the lower left of here. it only takes a few seconds to let someone know.

  5. #5
    Registered User
    Join Date
    10-09-2009
    Location
    Lloydminster, Sk
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: copying cells with a macro

    I have attached a copy of the file that am working on. What I want to do is copy the selected cells right, clear the content, add a date to the top so I can enter new data
    Attached Files Attached Files

  6. #6
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Talking Re: copying cells with a macro

    Two words "Macro Recorder"

    Instead of going through and copying everything to shift if over I went with a copy an insert. You aren't dealing with any merged cells so it's an easy shift.


    Please Login or Register  to view this content.
    This will keep your previous data and allow you to enter new data. If you like this solution please click on the scales to rate me, if this solves your issue then please select solved in your reply.

  7. #7
    Registered User
    Join Date
    10-09-2009
    Location
    Lloydminster, Sk
    MS-Off Ver
    Excel 2007
    Posts
    10

    Re: copying cells with a macro

    Thats not exactly what I had in mind, but I am going to go with that anyways. Thanks for your help.

  8. #8
    Forum Contributor vamosj's Avatar
    Join Date
    04-23-2004
    Location
    Oregon
    MS-Off Ver
    2010
    Posts
    294

    Re: copying cells with a macro

    If my previous post didn't work with what you had in mind, then what difference would it need to make it work for you?

    Are you only retaining a certain amount of data (A cutoff of how many columns you have)?

    Let me know and I can adjust the code.

+ 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