Hi there!
I'm new to this forum, so please let me know if I'm doing anything wrong!
I'm not versed in the arts of VBA, but have managed to find the codes I need through Google. The codes read:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Or Target.Cells.Count > 1 Then Exit Sub
Target.Offset(0, 1) = Now
End If
End Sub
These codes allow me to automatically insert a time stamp in Column 2, whenever Column 1 is filled or changed. Nice and simple.
I intend to run these codes twice on the same sheet, once for Column 1&2, and once for Column 5&6.
I've tried pasting the codes below themselves, like this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 5 Or Target.Cells.Count > 1 Then Exit Sub
Target.Offset(0, -1) = Now
End If
If Target.Column <> 5 Or Target.Cells.Count > 1 Then Exit Sub
Target.Offset(0, -1) = Now
End If
End Sub
But I then get a compilation error: end if without block if.
I've googled and read many post about combining VBAs, but still haven't come to grips.
So, many many thanks if you are willing to help!!!
Best,
Ed
I'm new to this forum, so please let me know if I'm doing anything wrong!
I'm not versed in the arts of VBA, but have managed to find the codes I need through Google. The codes read:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 1 Or Target.Cells.Count > 1 Then Exit Sub
Target.Offset(0, 1) = Now
End If
End Sub
These codes allow me to automatically insert a time stamp in Column 2, whenever Column 1 is filled or changed. Nice and simple.
I intend to run these codes twice on the same sheet, once for Column 1&2, and once for Column 5&6.
I've tried pasting the codes below themselves, like this:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column <> 5 Or Target.Cells.Count > 1 Then Exit Sub
Target.Offset(0, -1) = Now
End If
If Target.Column <> 5 Or Target.Cells.Count > 1 Then Exit Sub
Target.Offset(0, -1) = Now
End If
End Sub
But I then get a compilation error: end if without block if.
I've googled and read many post about combining VBAs, but still haven't come to grips.
So, many many thanks if you are willing to help!!!
Best,
Ed