Adding text and a timestamp to a cell using VBA

andrewb90

Well-known Member
Joined
Dec 16, 2009
Messages
1,077
Hello All,

I am trying to make a button that combines the value in one cell and adds the current date and time and places it in a new cell. So basically I am trying to take the text in C3("Completed At") and then add the date and time that the macro was run.

Any assistance would be greatly appreciated.


Thanks,

Andrew
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
Try this:

Code:
Option Explicit


Sub completed()
    ActiveCell.Value = Range("C3") & " " & Date & " " & Time
End Sub
 
Upvote 0
Another option would have been to use Now()

Code:
Sub completed2()
    ActiveCell.Value = Range("C3") & " " & Now()
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,290
Members
449,149
Latest member
mwdbActuary

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