0
我在工作表上使用兩次相同的宏。除非我重命名,否則表單不會讓我使用。每當我嘗試過它停止運作。重命名宏
下面你會發現我想要使用的兩個程序。任何人都可以告訴我如何重命名第一個以使其繼續工作?
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data 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:
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data 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:
Application.EnableEvents = True
End Sub