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

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Date[/TD]
[TD]1[/TD]
[TD]2[/TD]
[TD]3[/TD]
[TD]4[/TD]
[TD]5[/TD]
[TD]6[/TD]
[TD]7[/TD]
[TD]8[/TD]
[TD]9[/TD]
[TD]10[/TD]
[TD]11[/TD]
[TD]12[/TD]
[TD]13[/TD]
[TD]14[/TD]
[/TR]
[TR]
[TD]2/5/2019[/TD]
[TD]5[/TD]
[TD]3[/TD]
[TD]1[/TD]
[TD]12[/TD]
[TD]11[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]3[/TD]
[TD]9[/TD]
[TD]7[/TD]
[TD]56[/TD]
[TD]3[/TD]
[TD]2[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2/6/2019[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]1[/TD]
[TD]8[/TD]
[TD]9[/TD]
[TD]4[/TD]
[TD]6[/TD]
[TD]5[/TD]
[TD]3[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]2/7/2019[/TD]
[TD]1[/TD]
[TD]4[/TD]
[TD]3[/TD]
[TD]2[/TD]
[TD]1[/TD]
[TD]1[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]7[/TD]
[TD]9[/TD]
[TD]4[/TD]
[TD]3[/TD]
[TD]2[/TD]
[TD]10[/TD]
[/TR]
</tbody>[/TABLE]

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,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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