Updating time made by macro in excel

H

hjemmehososs

I have recorded a macro in excel. The macro includes current date and current
time which are pasted into two separate cells. I use ctrl+; and ctrl+: when
programming the macro.
When using the macro, the values of both date and time are constantly the
same as the date and time I made the macro.
How may the date and time be changed to the actual time when I use the macro?
Using the now() - function is not much help, as then all macros recorded
change to the actual date and time.

I used the program recorder.exe, and old -93-version earlier - but it does
not work with Vista.

Thankful if anyone can help me out here.
 
F

FSt1

hi
if you did it on record then you lines of code should looks something like
this....
ActiveCell.FormulaR1C1 = "12/29/07"
ActiveCell.FormulaR1C1 = "1:59pm"
anything in quotes will be interpeted by vb as literal which is why it keeps
putting your old date and time in.
change to....
ActiveCell.FormulaR1C1 = Date
ActiveCell.FormulaR1C1 = Time

regards
FSt1
 

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

Top