VBA Time/date stamp when copy/pasting values

tpowell1986

New Member
Joined
Jun 23, 2021
Messages
14
Office Version
  1. 365
Platform
  1. Windows
hi,

i need of some help please, i have a simple script that is copying values from a workbook to the next empty row on another tab, i would like to have a time and date stamp in column B showing when the information was pasted.

thanks in advance

Range("t2").Select
Range(Selection, Selection.End(xlDown)).Select
Selection.SpecialCells(xlCellTypeVisible).Select
Selection.Copy
Sheets("invoice").Range("A" & Rows.Count).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
 
still the same error sorry! i have tried it on a new workbook and still get the same error. its 365 if that matters?
 
Upvote 0

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Ok, let's try a different tack, how about
VBA Code:
   With Sheets("invoice").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
      .PasteSpecial xlPasteValues
      Range(.Offset(, 1), .End(xlDown).Offset(, 1)).Value = Now
   End With
 
Upvote 0
sorry spoke to soon, the date/time stamp in B is copying to the end of the sheet (row 1000000 something) rather than what has been pasted?
 
Upvote 0
Ok, how about
VBA Code:
   With Sheets("invoice").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
      .PasteSpecial xlPasteValues
      Range(.Offset(, 1), .Parent.Range("A" & Rows.Count).End(xlUp).Offset(, 1)).Value = Now
   End With
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,213,510
Messages
6,114,044
Members
448,543
Latest member
MartinLarkin

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