Multiple Fxns in single sheet module

Joined
Feb 27, 2014
Messages
1
Reaction score
0
Hi I am new here. I have a basic question. I have some code (see below) that I picked up. When you enter a value into the A column the current time is calculated in the B column.

I want to do the same for the C and D columns (see below as well) but I keep getting a compiling error when I put both functions into the same sheet module. I'm obviously a noob with all of this, but how do i separate multiple functions so that can both run on the same sheet?

Any and all help would be appreciated.

Private Sub Worksheet_Change
'when entering in a cell in Col A'
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 1 Then
n = Target.Row
If Me.Range("A" & n).Value <> "" Then
Me.Range("B" & n).Value = Format(Now, "hh:mm:ss AM/PM")
End If
End If
enditall:
EnableEvents = True
End Sub

---Second Calculation---

Private Sub Worksheet_Change
'when entering in a cell in Col C'
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 3 Then
n = Target.Row
If Me.Range("C" & n).Value <> "" Then
Me.Range("D" & n).Value = Format(Now, "hh:mm:ss AM/PM")
End If
End If
enditall:
.EnableEvents = True
End Sub
 
Back
Top