Hello,
I'm quiet new to VBA and I hope one of the smart people here has a (simple) sollution for my problem. I'm making a macro which automaticly will add the current date to a cell in the same row whenever the value in a nearby cell is changed to a certain value.
Richt now I can change the value in the cells in column D and the macro will add the date of the change in column B. But I also want to add a new line, where a change in column F to a certain value will add the current date in cell I.
Below is my code thus far. Can anyone show me what to do to make this code work?
Thanks in advance
Private Sub Worksheet_Change(ByVal Target As Range)
'Column 4 = D, Column 6 = F
If Not (Target.Column = 4 Or 6) Then Exit Sub
Application.EnableEvents = False
thisrow = Target.Row
If Target.Column = 4 And Target.Value = "Option 1" Then
Cells(thisrow, "B") = Date
End If
If Target.Column = 4 And Target.Value = "Option 2" Then
Cells(thisrow, "B") = Date
End If
If Target.Column = 4 And Target.Value = "Option 3" Then
Cells(thisrow, "B") = Date
End If
If Target.Column = 4 And Target.Value = "Option 4" Then
Cells(thisrow, "B") = Date
End If
If Target.Column = 4 And Target.Value = "option 5" Then
Cells(thisrow, "B") = Date
End If
If Target.Column = 4 And Target.Value = "Option 6" Then
Cells(thisrow, "B") = Date
End If
If Target.Column = 4 And Target.Value = "option 7" Then
Cells(thisrow, "B") = Date
End If
If Target.Column = 4 And Target.Value = "Option 8" Then
Cells(thisrow, "B") = Date
End If
If Target.Column = 6 And Target.Value = "Option A" Then
Cells(thisrow, "B") = Date
End If
Application.EnableEvents = True
End Sub
Bookmarks