S
sike11 via OfficeKB.com
I saw this code in an earlier posting:
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col B
Application.EnableEvents = False
On Error GoTo enditall
If Target.Cells.Column = 2 Then
n = Target.Row
If Excel.Range("B" & n).Value <> "" Then
Excel.Range("A" & n).Value = Now
End If
End If
enditall:
Application.EnableEvents = True
End Sub
I have made adjustments so that it can display the date and time in the
column I want. However,
I get an error which says "Argument not optional".
Please help. Also, would it be possible to adjust it so that it works across
multiple worksheets?
Thank you in advance.
This is sheet event code.
Right-click on the sheet tab and "View Code".
Copy/paste into that module.
Macros must be enabled by the user when opening the workbook for this code to
be
available.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
'when entering data in a cell in Col B
Application.EnableEvents = False
On Error GoTo enditall
If Target.Cells.Column = 2 Then
n = Target.Row
If Excel.Range("B" & n).Value <> "" Then
Excel.Range("A" & n).Value = Now
End If
End If
enditall:
Application.EnableEvents = True
End Sub
I have made adjustments so that it can display the date and time in the
column I want. However,
I get an error which says "Argument not optional".
Please help. Also, would it be possible to adjust it so that it works across
multiple worksheets?
Thank you in advance.
This is sheet event code.
Right-click on the sheet tab and "View Code".
Copy/paste into that module.
Macros must be enabled by the user when opening the workbook for this code to
be
available.