Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to insert a macro that when i click a specific set of keys it
insert todays date in the specified cell, how can i do that please thank you ant |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I would like to insert a macro that when i click a specific
set of keys it insert todays date in the specified cell, how can i do that please Excel already has this feature... Ctrl + ; (Control Key plus Semi-Colon Key) and if you add the Shift Key to that, it inserts the time... Ctrl + Shift + ; (Control Key plus Shift plus Semi-Colon Key) Rick |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You don't really need a macro for that.
Current date Select a cell and press CTRL+; However, if you want a macro: Sub insDate() ActiveCell = Format(Now, "d/m/yyyy") End Sub "Antonius" wrote: I would like to insert a macro that when i click a specific set of keys it insert todays date in the specified cell, how can i do that please thank you ant |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Or, even more simply:
Public Sub insDate() ActiveCell.Value = Date End Sub Using Format() to convert Now (which contains both date and time) to a string, then having XL's parser interpret the string isn't necessary. How the date is interpreted will depend on your system date settings (e.g., Format(Date, "d/m/yyyy") on 7 August 2007 (resulting in 7/8/2007), will be interpreted as 8 July 2007 if your date settings are set to standard US. The displayed date format will depend on the cell's display format, not the format you input it with. If you want a particular format, you should change the cell's ..NumberFormat property, e.g.: Public Sub insDate() With ActiveCell .Value = Date .NumberFormat = "d/m/yyyy" End With End Sub In article , JLGWhiz wrote: You don't really need a macro for that. Current date Select a cell and press CTRL+; However, if you want a macro: Sub insDate() ActiveCell = Format(Now, "d/m/yyyy") End Sub |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thank you so much, but what if i want it to insert the date in a specified
cell i.e. D10 what shall i do "JE McGimpsey" wrote: Or, even more simply: Public Sub insDate() ActiveCell.Value = Date End Sub Using Format() to convert Now (which contains both date and time) to a string, then having XL's parser interpret the string isn't necessary. How the date is interpreted will depend on your system date settings (e.g., Format(Date, "d/m/yyyy") on 7 August 2007 (resulting in 7/8/2007), will be interpreted as 8 July 2007 if your date settings are set to standard US. The displayed date format will depend on the cell's display format, not the format you input it with. If you want a particular format, you should change the cell's ..NumberFormat property, e.g.: Public Sub insDate() With ActiveCell .Value = Date .NumberFormat = "d/m/yyyy" End With End Sub In article , JLGWhiz wrote: You don't really need a macro for that. Current date Select a cell and press CTRL+; However, if you want a macro: Sub insDate() ActiveCell = Format(Now, "d/m/yyyy") End Sub |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
thank you so much, but what if i want it to insert the date in a specified
cell i.e. D10 what shall i do Using JE McGimpsey's suggested subroutine framework... Public Sub insDate() Range("D10").Value = Date End Sub Rick |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to jump to today's date | Excel Discussion (Misc queries) | |||
set cell to today's date macro | Excel Programming | |||
A macro for the today's date...not the current date | Excel Programming | |||
Macro to filter on today's date | Excel Programming | |||
Macro to filter on today's date | Excel Programming |