View Full Version : 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
Charlize
04-09-2007, 12:54 PM
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Selection.Count > 1 Then Exit Sub
If Target.Column = 4 Then
Target.NumberFormat = "dd/mm"
Target.Value = Date
Cancel = True
End If
End SubCharlize
Simon Lloyd
04-09-2007, 12:58 PM
Hi, format column D as custom and then dd.mm then add this to the worksheet code module:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("D:D")) Is Nothing Then
Target.Value = Date
Cancel = True
End If
End Sub
Regards,
Simon
hi,
charlize's and yours does not work, what is the problem ?
Simon Lloyd
04-09-2007, 01:16 PM
Works fine for me!, post your workbok or example workbook!
hi,
please check the attached file.code is in module 4
regards
hi,
charlizes works.I changed the place of code.yours has format problem
thanks
Simon Lloyd
04-10-2007, 01:45 AM
Aoc, the code supplied by both myself and Charlize was to be placed in the Worksheet code module NOT a standard module as per our instructions!
Regards,
Simon
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.