Hello there,
Forgive my ignorance, it's been many a year since I have been working with VBA.
I'm currently trying to get a function working where there should be matching cells in two different columns on the same row, but if there is no match then apply a date stamp in a 3rd column.
I can get the date stamp to work but only if 1 column changes and doesn't match - but what I am trying to achieve is if either of the two columns change and don't match - apply a date stamp and If they do match, remove the date stamp and finally if one of the cells is blank; remove or don't apply a date stamp.
Code
Private Sub Worksheet_Change(ByVal Target As Range)
If Cells(1, Target.Column).Value = "" And Cells(2, Target.Column).Value = "" Then
Cells(Target.row, 3).ClearContents
'Exit Sub
Else
If Cells(1, Target.Column).Value <> Cells(2, Target.Column).Value Then
Cells(Target.row, 3).Value = Format(Now, "yyyy-mmm-dd hh:mm:ss")
Else
If Cells(1, Target.Column).Value = Cells(2, Target.Column).Value Then
Cells(Target.row, 3).ClearContents
'Exit Sub
End If
End If
End If
End Sub
Display More
Any advice would highly be appreciated,
Cheers,
Kevin