bearcub
Well-known Member
- Joined
- May 18, 2005
- Messages
- 734
- Office Version
- 365
- 2013
- 2010
- 2007
- Platform
- Windows
I have a spreadsheet where I need to track the time a date was entered in two different tables. I would like it remain static. I've been searching the web for something like this but I see either a formula in the worksheet change event or formulas inserting the Now function. I don't want to use the NOW() function since the time will change whenever I update the spreadsheet and the time changes.
I need something which behaves like the ctl-sht-; keys - not as a macro but as a function.
How would you convert the traditional sheet change event approach:
I need something which behaves like the ctl-sht-; keys - not as a macro but as a function.
How would you convert the traditional sheet change event approach:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim r As Range
Set r = Target
If Intersect(Range("K:K"), r) Is Nothing Then Exit Sub
If r.Value <> 1 Then Exit Sub
If r.Offset(0, 1).Value <> "" Then Exit Sub
Application.EnableEvents = False
r.Offset(0, 1) = Date
Application.EnableEvents = True
End Sub
[code/]
I will be using this function in different areas of the worksheet so I would need to have a function that I could enter into a cell which points to the cell adjacent to it?
Is this possible?
Thank you for your help in advance,
Michael