Double Click

J

jbchrist

Hello,

I am trying to learn the basics of events, and create an event so tha
when I double click a cell in a column it enters the current date.
Thanks

Joh
 
F

Frank Kabel

Hi
try the following worksheet code
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As Boolean)
Application.EnableEvents = False
Target.Value = Date
Application.EnableEvents = True
Cancel = True
End Sub
 
F

Frank Kabel

Hi
first: it is an event code (see:
http://www.cpearson.com/excel/events.htm)

The rest is quite simple:
- the code is invoked after a double-click occurs on this sheet
- first the events are enabled (to prevent any other event procedures)
- at the position (target) the current date is inserted and the events
are enabled again
- the last statement just prevents the normal processing of a
doubl-click
 
Top