VBA Code to add date

  • Thread starter Thread starter npereira
  • Start date Start date
N

npereira

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
 
Sub dodate()
'ActiveCell = Date 'with cell preformatted or
ActiveCell = Format(Date, "mmmm dd,yyyy")
End Sub
 
Private Sub CommandButton1_Click()
Range("E11").Value = Format(Date, "mmmm dd,yyyy")
End Sub
 
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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top