ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA Code to add date (https://www.excelbanter.com/excel-programming/313808-vba-code-add-date.html)

npereira[_3_]

VBA Code to add date
 

Hello all,

I am trying to find out what code to add to a command button to inser
todays date formated as " October 17, 2004 " in Cell E 11.

Please let me know.

regards,

Nelso

--
npereir
-----------------------------------------------------------------------
npereira's Profile: http://www.excelforum.com/member.php...fo&userid=1079
View this thread: http://www.excelforum.com/showthread.php?threadid=26998


Don Guillett[_4_]

VBA Code to add date
 

Sub dodate()
'ActiveCell = Date 'with cell preformatted or
ActiveCell = Format(Date, "mmmm dd,yyyy")
End Sub
--
Don Guillett
SalesAid Software

"npereira" wrote in message
...

Hello all,

I am trying to find out what code to add to a command button to insert
todays date formated as " October 17, 2004 " in Cell E 11.

Please let me know.

regards,

Nelson


--
npereira
------------------------------------------------------------------------
npereira's Profile:

http://www.excelforum.com/member.php...o&userid=10799
View this thread: http://www.excelforum.com/showthread...hreadid=269988




JMay

VBA Code to add date
 
Private Sub CommandButton1_Click()
Range("E11").Value = Format(Date, "mmmm dd,yyyy")
End Sub


"npereira" wrote in message
...

Hello all,

I am trying to find out what code to add to a command button to insert
todays date formated as " October 17, 2004 " in Cell E 11.

Please let me know.

regards,

Nelson


--
npereira
------------------------------------------------------------------------
npereira's Profile:

http://www.excelforum.com/member.php...o&userid=10799
View this thread: http://www.excelforum.com/showthread...hreadid=269988




Dave Peterson[_3_]

VBA Code to add date
 
Option Explicit
sub testme01()
with activesheet.range("e11")
.value = date
.numberformat = "mmmm dd, yyyy"
end with
end sub

But if you want a shortcut to enter today's date, you can use ctrl-;
(control-semicolon). You'll have to format the cell the way you want, though.

==
and the shortcut for entering the current time is ctrl-: (control-colon).



npereira wrote:

Hello all,

I am trying to find out what code to add to a command button to insert
todays date formated as " October 17, 2004 " in Cell E 11.

Please let me know.

regards,

Nelson

--
npereira
------------------------------------------------------------------------
npereira's Profile: http://www.excelforum.com/member.php...o&userid=10799
View this thread: http://www.excelforum.com/showthread...hreadid=269988


--

Dave Peterson



All times are GMT +1. The time now is 10:40 AM.

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