View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default How do I code a cell to display the current date on double-click?

If the cell for your date is range named, say "main.date" then your
doubleclick event is easier to follow

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, _
Cancel
As Boolean)
Dim rDate As Range
Set rDate = ThisWorkbook.Names.Item("main.date").RefersToRange
If Target.Address = rDate.Address Then
Cancel = True
Target.Value = Now
End If
End Sub

HTH
Patrick Molloy
Microsoft Excel MVP

"George" wrote:

Hi, I want to be able to have the current date entered into a given
cell, when I double-click it.

It will always be a cell, in one particular column, reserved for date.
Jim