View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
[email protected] rdraper@bctonline.com is offline
external usenet poster
 
Posts: 5
Default How to select cell and have time or date appear?

The code works great, but is this the proper way to add a second if
statement?

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("B4:B100")) Is Nothing Then
With Target
.Value = Format(Now, "hh:mm:ss")
End With
End If
If Not Intersect(Target, Me.Range("A4:A100")) Is Nothing Then
With Target
.Value = Format(Date, "m/d/yyyy")
End With
End If

ws_exit:
Application.EnableEvents = True


End Sub