Dashivas123
New Member
- Joined
- May 15, 2021
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hi all,
I need a macro to put the today's date into column X1, X2, X3, X4 , which are for example the 10th, 11th, 12th column to the right of X1,X2,X3 etc. ((f.e. columns X11, X12, X13, X14 etc)) . if the cell in the original columns are changed color manually. The timestamp automatically needs to be put in X11,X12,X13 etc. if the cells in X1,X2,X3 etc. changed color manually (so in excel with manually fill color button).
I already found with VBA how to do this if the cells changes values (like in character/data changes), but this does NOT work when the cell changes color (only if new data is entered). I need the timestamp if the color is changed. See the script I already found below.
I searched for a long time on internet and threads but without succes so far, thanks in advance! Please I need your help,
Dash
Code for timestamps in 18th column to the right of changed column cell when data in cell is changed, but still not for manual color changes:
Also posted here I need a timestamp into cell in columns X11 when cell in column X1 is colored manually
I need a macro to put the today's date into column X1, X2, X3, X4 , which are for example the 10th, 11th, 12th column to the right of X1,X2,X3 etc. ((f.e. columns X11, X12, X13, X14 etc)) . if the cell in the original columns are changed color manually. The timestamp automatically needs to be put in X11,X12,X13 etc. if the cells in X1,X2,X3 etc. changed color manually (so in excel with manually fill color button).
I already found with VBA how to do this if the cells changes values (like in character/data changes), but this does NOT work when the cell changes color (only if new data is entered). I need the timestamp if the color is changed. See the script I already found below.
I searched for a long time on internet and threads but without succes so far, thanks in advance! Please I need your help,
Dash
Code for timestamps in 18th column to the right of changed column cell when data in cell is changed, but still not for manual color changes:
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
'Update 20140722
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Set WorkRng = Intersect(Application.ActiveSheet.Range("C:C, D:D, E:E, H:H, I:I, J:J, M:M, N:N, O:O"), Target)
xOffsetColumn = 18
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each Rng In WorkRng
If Not VBA.IsEmpty(Rng.Value) Then
Rng.Offset(0, xOffsetColumn).Value = Now
Rng.Offset(0, xOffsetColumn).NumberFormat = "dd-mm-yyyy, hh:mm:ss"
Else
Rng.Offset(0, xOffsetColumn).ClearContents
End If
Next
Application.EnableEvents = True
End If
End Sub
Also posted here I need a timestamp into cell in columns X11 when cell in column X1 is colored manually
Last edited by a moderator: