Filling a cell with today's date (Datestamp completed marco)

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a macro written and I would like to have it put a datestamp in a cell
after running. Basically I would like it to fill a cell with today's date as
the last line of code so I can keep track of when it was last run
successfully. I tried the following, but it does not seem to work.

Range("F5") = Now

Any help would be greatly appreciated.
Regards, diane
 
Diane,

Try this...

Range("F5").Value = Format(Date, "mmm,dd,yyyy")

Regards,
Jim Cone
San Francisco, USA
 
Been using this for onths..works well

ActiveCell.FormulaR1C1 = Now()

Selection.Font.Bold = True
Selection.NumberFormat = "[$-409]d-mmm-yy;@"

Ian M
 
Hi Diane,

Try puting parenthesis at the end ie.

Range("F5") = Now()

Cheers
 
Thank you all for helping me. Not only was my code wrong, I was testing the
wrong macro to see if it would work - need some coffee maybe ;-)
 
This will put it at the end of F if you do not know where the last cell
with data is.

Sub DateAtEnd()
'
' Finds End of Column and insert date and time.
Range("f2").Select
Selection.End(xlDown).Select
ActiveCell.Offset(1, 0).Select
ActiveCell.FormulaR1C1 = Now()

End Sub
 
Diane said:
I have a macro written and I would like to have it put a datestamp in a cell
after running. Basically I would like it to fill a cell with today's date as
the last line of code so I can keep track of when it was last run
successfully. I tried the following, but it does not seem to work.

Range("F5") = Now

Any help would be greatly appreciated.
Regards, diane
 
Diane,

You may do that as follow:


Application.Goto Reference:="R12C1"
ActiveCell.FormulaR1C1 = "=NOW()"

line 1 will bring you to the desired cell (in this example A12)
Line 2 fills the datestamp in mentioned cell.
You may use a variable for the cell reference so you can use the same
routine and only need to change the variable on forehand.
Please make sure the target cells for the datestams are formated
properly. (dd-mm-yy HH:MM:SS) or whatever you want. General format may
do the job also.

Regards,

Ronald.
 

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