Dear all,
In a previous post on this forum a formula for creating a "last updated" cell for a certain range of cells is given. For instance, if cells A1 till A3 change, A4 will display: Last updated on: 22-6-2012.
I've changed the formule (in MVB) myself into the range I need. B3 till BZ3 changes A3 will display the date of today. See formula below.
Private a(1) As Variant
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
a(0) = a(1)
a(1) = Range("b3:bz3").Value
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
If Intersect(Target, Range("b3:bz3")) Is Nothing Then Exit Sub
For i = 1 To UBound(a(0), 1)
If Range("a" & i).Value <> a(0)(i, 1) Then
msg = msg & Date & vbLf
End If
Next
If Len(msg) Then
With Application
.EnableEvents = False
.Undo
Range("a3").Value = msg
.EnableEvents = True
End With
a(1) = Range("b3:bz3").Value
End If
End Sub
Now, here's the question: I want this formule for the whole column. So, if B4 till BZ4 changes, I want A4 to display the date of today, and so on.
What do I have to modify in the formula to achieve that?
I'm looking forward to your responses!
Kind regards,
Laurens
In a previous post on this forum a formula for creating a "last updated" cell for a certain range of cells is given. For instance, if cells A1 till A3 change, A4 will display: Last updated on: 22-6-2012.
I've changed the formule (in MVB) myself into the range I need. B3 till BZ3 changes A3 will display the date of today. See formula below.
Private a(1) As Variant
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
a(0) = a(1)
a(1) = Range("b3:bz3").Value
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim i As Integer
If Intersect(Target, Range("b3:bz3")) Is Nothing Then Exit Sub
For i = 1 To UBound(a(0), 1)
If Range("a" & i).Value <> a(0)(i, 1) Then
msg = msg & Date & vbLf
End If
Next
If Len(msg) Then
With Application
.EnableEvents = False
.Undo
Range("a3").Value = msg
.EnableEvents = True
End With
a(1) = Range("b3:bz3").Value
End If
End Sub
Now, here's the question: I want this formule for the whole column. So, if B4 till BZ4 changes, I want A4 to display the date of today, and so on.
What do I have to modify in the formula to achieve that?
I'm looking forward to your responses!
Kind regards,
Laurens