+ Reply to Thread
Results 1 to 8 of 8

Macro to cut & paste continually adding data?

  1. #1
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Macro to cut & paste continually adding data?

    Hello,

    Is it possible to write a simple macro that will cut data & paste it? For example, when I run this macro it

    cuts the data from cells A1:A3 and pastes it in cells D1:D3?
    Last edited by Rick-O-Shay; 12-30-2009 at 01:36 PM.

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

    Re: Macro to cut & paste?

    Hi Rick-O-Shay,

    welcome to the forum.

    Have you tried using the macro recorder to do the copy and paste? That's a good starting point to create macros that you can edit and change to your needs, if you want to learn about VBA.

    You can try out the differences with relative and absolute referencing and try and define source cells and target cells for the copy and paste operation after studying the code.

    Once you have a base example, you could come back here for advice on fine-tuning.

    hth

  3. #3
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Re: Macro to cut & paste?

    Well, I'm not too good with VBA and Macros, but what I am doing is I have a spreadsheet where data is entered in cells A1:A3 and I have a button (which I need a Macro for) where when pressed it will take that data and put it in cells D1:D3 and hopefully, (if this is even possible) each time data is entered in cells A1:A3 and the button is pressed, data will trickel down a line. So next time I press the button the data is placed on E1:E3 etc....

    Is this possible? If so, can anyone give me a basic script to do this? One I have my basic script I am learning my way around by looking at what others do.

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

    Re: Macro to cut & paste?

    OK,

    start the macro recorder, do your copy and paste thing and stop the macro recorder.

    Then post the generated code here and ask how this code can be modified to paste in the next available empty row.

    I'm sure you will get answers (not from me, though, I'm afraid I'm still learning this stuff myself!)

    cheers

  5. #5
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Macro to cut & paste?

    Here's what Teylyn means,

    Try to understand the recorded macro. Then rework it to a more efficient code. VBA recorder in XL is not that good. It was much better in Lotus 123 (so I heard)

    Please Login or Register  to view this content.
    and reworked:
    Please Login or Register  to view this content.
    Last edited by rwgrietveld; 12-30-2009 at 03:17 AM.
    Looking for great solutions but hate waiting?
    Seach this Forum through Google

    www.Google.com
    (e.g. +multiple +IF site:excelforum.com/excel-general/ )

    www.Google.com
    (e.g. +fill +combobox site:excelforum.com/excel-programming/ )

    Ave,
    Ricardo

  6. #6
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Re: Macro to cut & paste?

    Ok here is my base code

    Please Login or Register  to view this content.
    Ok, Here is my problem. I need to make this code so that each time it is run the data is dropped down a line. For example, it is run this time and pasted in A8:C8, next time it pastes the data in cells A9:C9... how do I do this?
    Last edited by Rick-O-Shay; 12-30-2009 at 01:33 PM.

  7. #7
    Forum Contributor
    Join Date
    12-30-2009
    Location
    US
    MS-Off Ver
    Excel 2003, 2010, 2016, 2019, & Office 365
    Posts
    194

    Re: Macro to cut & paste continually adding data?

    I guess I should say, is this even possible? Does it make sense?

    I need to keep a log of information and I don't want it to write on top of my current data. This macro would allow me to continue to place what is put in cells A1:C1 down the excel spreadsheet.

  8. #8
    Valued Forum Contributor rwgrietveld's Avatar
    Join Date
    09-02-2008
    Location
    Netherlands
    MS-Off Ver
    XL 2007 / XL 2010
    Posts
    1,671

    Re: Macro to cut & paste continually adding data?

    So if I understand correctly:
    A1:C1 has the data.
    This data needs to be put under the last recorded log?

    What can be done is find out where the last enty is. This is done frequently with the code.
    Please Login or Register  to view this content.
    Putting this together with your current code:

    Please Login or Register  to view this content.

+ 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