VBA Button to copy a row of data and place it on the next worksheet

daltendavis

New Member
Joined
Jun 26, 2018
Messages
37
Hi all, thanks in advance for the help. Looking to be able to copy a row of data and place it on the a separate sheet within the workbook using a button. This would be a daily process, so the sheet where the data would be pasted would need to compile. (I have already created the clear button for the daily input)

For example today is 2/5/2019, tomorrow I would enter in the data run the report and have it copied across to the next sheet so there would be then in column A Row 1 2/5/2019 and its corresponding data from that day thru 10-15 columns, followed by 2/6/2019 in Column A Row 2 and its corresponding data.

Thank you!!! any questions fire away!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Date1234567891011121314
2/5/201953112110039756321
2/6/201900001018946531
2/7/2019143211007943210

<tbody>
</tbody>

This is what I am looking for the button to do once it copies the daily data and pastes it over to the new worksheet, slowly compiling day by day
 
Upvote 0
Hi


This should get you started. NB: I've not written a save routine because I don't know where the source data is, therefore the code is a bit open in not using exact workbook & sheet names, so best to check your results before saving. I have also assumed that it is only 1 row of data that is being transferred which seems to be implied by your example.


Public Sub TransferData()


Dim c, d As Range
Dim CopyWkb, DestWkb As Workbook




'###########################################################################################################
' Make sure the copy book is the active book / window, and you are on the sheet with the data to be copied.
'###########################################################################################################


Set CopyWkb = ActiveWorkbook '## replace "= Workbooks("name of your copy book") if it's always the same.


Set DestWkb = Workbooks("Book1") '## replace "Book1" with name of your destination book


Set c = Range("A2:O2")


Set d = DestWkb.Worksheets("Sheet1").Range("a1").End(xlDown)
Set d = d.Offset(1, 0).Resize(1, 15)


d.Value = c.Value


DestWkb.Activate


d.Select
 
Upvote 0

Forum statistics

Threads
1,215,220
Messages
6,123,693
Members
449,117
Latest member
Aaagu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top