Creating a macro that inserts the current date into a cell

posted in: Excel Tutorials | 0

Creating a macro that inserts the current date into a cell

For a guide to how to edit macros for your own purposes, please click here.

In this video we outline how to create a macro that inserts the current date into a newly created cell. This is useful if you are creating new rows and would like this to also populate a certain field with the current date that this occurs.

 

 

The code that we used in this tutorial is as follows.

 

Private Sub CommandButton1_Click()

Sheets(“Sheet1”).Range(“A4”).Select
ActiveCell.EntireRow.Insert shift:=xlDown

Sheets(“Sheet1”).Range(“A4:E4”).Select
Selection.Borders.Weight = xlThin

Sheets(“Sheet1”).Range(“e4”).Select
ActiveCell.Formula = “=today()”

End Sub

You will need to tailor the range to suit your own requirements on your own spreadsheet within the code.

To download a copy of this workbook then please click the link below.

INR + Date

If you have any questions in regards to this video please post these to the YouTube channel. 

If this has been helpful then please like or subscribe to the channel.

Leave a Reply