Hey guys, today for the first time in my life I faced a situation when I need VBA. I've found a code that works for me (thanks Google!) but the thing is that I need to apply it 2 times (change in column 7 registered in column 8 and change in column 9 registered in column 10) on he same worksheet. As far as I understand I need to combine it into 1 sub. I've tried several variants but all of them end up with an error. Pleaaaaase I need your help so much - how to combine it? Thank you in advance
Code
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Column <> 7 Then Exit Sub
- If Target.Cells.Count > 1 Then Exit Sub
- With Target.Offset(0, 1)
- .Value = Now
- .NumberFormat = "MM/DD/YYYY"
- End With
- End Sub
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Column <> 9 Then Exit Sub
- If Target.Cells.Count > 1 Then Exit Sub
- With Target.Offset(0, 1)
- .Value = Now
- .NumberFormat = "MM/DD/YYYY"
- End With
- End Sub