Copy data from one sheet into a another sheet on a new line

ScottEmberson

New Member
Joined
Jul 31, 2014
Messages
12
Hello
I am trying to take data from specific cells on PBI_DATA_SORT and paste it into a new line in PBI_DATA_SORT_TRACKING with a date and time stamp in separate cells.

I have been able to get it to copy from one to another but not with a date and time stamp.

Code:
Sub Macro3()
'
' Macro3 Macro
'
Sheets("PBI_DATA_SORT").Range("D139:H139,M139").Copy
Sheets("PBI_DATA_SORT_TRACKING").Cells(Rows.Count, "B").End(xlUp).Offset(1). _
PasteSpecial Paste:=xlPasteValues, _
Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Sheet
End Sub

This is how the table would look like in sheet PBI_DATA_SORT_TRACKING
DateTimeTotal1Total2Total3Total4Total5Total6

<tbody>
</tbody>
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
I'm not sure how you want you're final sheet to look, i.e. which cells the date and time stamps will go into, but you can easily insert them as follows:

Code:
Range("A1") = Date
Range("A2") = Time
Hope this helps,

Chris.
 
Upvote 0
Thanks for this but it will only place it into Cells A1 and A2 I need it to follow the rest of the data as it drops down by a row each time the code is run. e.g. (Hope the table helps to explain it a bit better)

DateTimeTotal1Total2Total3Total4Total5Total6
22/07/201409:301235634862652352
23/07/201410:22135354135351586376

<tbody>
</tbody>
 
Upvote 0
You can use something from your existing macro to accomplish this:

Code:
n = Cells(Rows.Count, "C").End(xlUp).Row
Range("A" & n) = Date
Range("B" & n) = Time
This is provided your data has already been pasted into columns C to H.

Hope this helps,

Chris.
 
Upvote 0

Forum statistics

Threads
1,213,497
Messages
6,113,998
Members
448,539
Latest member
alex78

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