Thread: Inefficient?
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Inefficient?

Don't forget events

Private Sub Worksheet_nChange(ByVal Target As Range)

On Error GoTo ws_exit:
Application.EnableEvents = False
With Target
If .Column < 1 And .Row 4 Then
Cells(.Row, 1).Value = Now
End If
End With

ws_exit:
Application.EnableEvents = True
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Steph" wrote in message
...
Thanks!

"Toppers" wrote in message
...
This?

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 1 And Target.Row 4 Then
Cells(Target.Row, 1).Value = Now
End If
End Sub


"Steph" wrote:

Is there a better way to write this??

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 1 And Target.Row < 1 And Target.Row < 2 And
Target.Row < 3 And Target.Row < 4 Then
Cells(Target.Row, 1).Value = Now
End If
End Sub