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.
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?
Best Office Productivity Tools
Supercharge Your Excel Skills with Kutools for Excel, and Experience Efficiency Like Never Before. Kutools for Excel Offers Over 300 Advanced Features to Boost Productivity and Save Time. Click Here to Get The Feature You Need The Most...
Office Tab Brings Tabbed interface to Office, and Make Your Work Much Easier
- Enable tabbed editing and reading in Word, Excel, PowerPoint, Publisher, Access, Visio and Project.
- Open and create multiple documents in new tabs of the same window, rather than in new windows.
- Increases your productivity by 50%, and reduces hundreds of mouse clicks for you every day!