Updating time made by macro in excel

  • Thread starter Thread starter hjemmehososs
  • Start date Start date
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.
 
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
 
Back
Top