Excel creates date stamp when cell is refreshed
1 answer
Include the following macro macro in the code area of the worksheet:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rng As Range, r As Range, H As Range
Set H = Range("H:H")
Set rng = Intersect(H, Target)
If rng Is Nothing Then Exit Sub
Application.EnableEvents = False
For Each r In rng
Cells(r.Row, "N").Value = Date
Next r
Application.EnableEvents = True
End Sub
Since this is the worksheet code, it is very easy to install and use it automatically:
- right click the tab name at the bottom of the Excel window.
- select View Code - displays the VBE window
- paste content and close VBE window
If you have any problem, please try it on a sample sheet first.
If you save the workbook, the macro will be saved with it. If you are using a version of Excel later than 2003, you must save the file as .xlsm and not .xlsx
To remove a macro:
- bring up VBE windows as above.
- clear code
- close VBE window
To learn more about macros in general, see
http://www.mvps.org/dmcritchie/excel/getstarted.htm
and
http://msdn.microsoft.com/en-us/library/ee814735(v=office.14).aspx
To learn more about event macros (worksheet code), see
http://www.mvps.org/dmcritchie/excel/event.htm
Macros must be enabled for this!
+1
source to share