How to insert timestamp into specific cell when macro is run in Excel?
This article is talking about inserting timestamp into specific cell when a certain Macro is running in Excel.
Recommended Productivity Tools for Excel
Office Tab: Bring powerful tabs to Office (include Excel), just like Chrome, Safari, Firefox and Internet Explorer. Save you half the time, and reduce thousands of mouse clicks for you. 30-day Unlimited Free Trial
Kutools for Excel: Save 71% of your time and solve 82% Excel problems for you. 300+ advanced tools designed for 1500+ work scenario, make Excel much easy and increase productivity immediately.60-day Unlimited Free Trial
Supposing you need to automatically populate cell A1 in current worksheet with timestamp when a certain Macro is triggered. Please do as follows.
1. Press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, click Insert > Module. Then copy and paste the below VBA code into the Code window. See screenshot:
VBA code: Insert timestamp into specific cell when Macro is run
Sub macro() 'Insert your macro here [A1] = Now End Sub
Note: In the code, please replace the 'Insert your macro here with the certain VBA code you will run. And A1 is the cell that will populate the current timestamp.
3. Press the F5 key to run the code. After executing the specific code, the timestamp will be inserted into cell A1 automatically in your worksheet.
- How to insert or display last saved timestamp on worksheet in Excel?
- How to insert current timestamp when data in another cell changes in Excel?