Time/Date auto insert upon click

K

Keyrookie

Hey all

I have set up a left double click command to insert time (code below
"BeforeDoubleClick") in rows C and D and I also have a code that insert
the current date one row to the left of column C. However, when
double click in row C, Excel will insert the current time but the cod
to insert the date one row to the left is ignored. I can get the dat
code to function if I insert the time in row C by using th
CTRL+SHIFT+Colon keyboard shortcut, but I'd prefer to just double clic
in Row C like I can in Row D.

What am I missing?

Thanks for your help
Keyrooki

Private Sub Worksheet_Change(ByVal Target As Excel.Range
With Targe
If .Count > 1 Then Exit Su
If Not Intersect(Range("C:C"), .Cells) Is Nothing The
Application.EnableEvents = Fals
If IsEmpty(.Value) The
.Offset(0, -1).ClearContent
Els
With .Offset(0, -1
.NumberFormat = "dddd, mm/dd/yy
.Value = No
End Wit
End I
Application.EnableEvents = Tru
End I
End Wit
End Su


Private Sub Worksheet_BeforeDoubleClick
(ByVal Target As Range, Cancel As Boolean
Const MY_RANGE As String = "C:D
Dim cell As Dat
On Error GoTo endit
Application.EnableEvents = Fals
If Not Intersect(Target, Me.Range(MY_RANGE)) Is Nothing The
Target.Value = Format(Time, "hh:mm AM/PM"
End I
Cancel = Tru
endit
Application.EnableEvents = Tru
End Su
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top