Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Personal.xls macro syntax question 2

Status
Not open for further replies.

mscallisto

Technical User
Jun 14, 2001
2,990
US
I currently have a Personal.xls file in
C:\Program Files\MicroSoft Office\Office11\xlstart\
and have a macro to place a path and filename in my headings.

Code:
Sub Set_Head_Foot()
  With ActiveSheet.PageSetup
    .LeftHeader = ""
    .CenterHeader = "&""Comic Sans MS,Italic""&10" & ActiveWorkbook.Path + "\" + ActiveWorkbook.Name
    .RightHeader = ""
    .LeftFooter = ""
    .CenterFooter = ""
    .RightFooter = ""
  End With
End Sub

I would like to add another macro that would fill the cell I am currently in (any sheet) with the current date [when I hit CTRL & T].

I simply need some syntax assistance.
 
Something like this ?
ActiveCell = Date

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
There are several ways you can do this:

Code:
Activecell.Value=Date

Or:

Code:
Activecell.FormulaR1C1="=Today()" 'Gives today's date.  CAUTION:  This changes each time the workbook is opened.

Or:

Code:
Activecell.Value = #1/1/2006#

I hope this helps.




Ron Repp

If gray hair is a sign of wisdom, then I'm a genius.
 
Thanks ... I figured it was that easy!!

How can I add a format to that so the date appears dd-Mth-yy?

e.g. 25-Jun-07
 
ActiveCell.NumberFormat = "dd-mmm-yy"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Code:
Very Much ... Baie Dankie

        ("`-''-/").___..--''"`-._        
         `6_ 6  )   `-.  (     ).`-.__.`)
         (_Y_*.)  ._   )  `._ `. ``-..-' 
       _..`--'_..-_/  /--'_.' ,'         
      (il), ''  (li),'  ((!.-'    

S.A.M.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top