ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding date with double click (https://www.excelbanter.com/excel-programming/387096-adding-date-double-click.html)

excel-tr

adding date with double click
 
hi,

how can I add the day and month like 29.03 when I double click any cell in
column D ?

regards
--
SAHRAYICEDIT-ISTANBUL

Gary''s Student

adding date with double click
 
Paste this in Worksheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Intersect(Target, Range("D:D")) Is Nothing Then
Else
Target.Value = Now()
Target.NumberFormat = "dd.mm"
End If
Cancel = True
End Sub
--
Gary''s Student - gsnu200714


"excel-tr" wrote:

hi,

how can I add the day and month like 29.03 when I double click any cell in
column D ?

regards
--
SAHRAYICEDIT-ISTANBUL


Gord Dibben

adding date with double click
 
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
On Error GoTo enditall
Application.EnableEvents = False
If Target.Cells.Column = 4 Then
Target.Value = Format(Date, "dd.mm")
End If
Cancel = True
enditall:
Application.EnableEvents = True
End Sub

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste the above into that sheet module.


Gord Dibben MS Excel MVP


On Mon, 9 Apr 2007 12:34:03 -0700, excel-tr
wrote:

hi,

how can I add the day and month like 29.03 when I double click any cell in
column D ?

regards




All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com