Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Updating time made by macro in excel

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.
--
hjemmehososs
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Updating time made by macro in excel

Hi,

Use instructions :
Range("A1").Value = Date
Range("B1").Value = Time

HTH
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Updating time made by macro in excel

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

"hjemmehososs" wrote:

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.
--
hjemmehososs

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Updating time made by macro in excel

Thank you very much for your advice.
It was very helpful and made my day!
--
hjemmehososs


"FSt1" wrote:

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

"hjemmehososs" wrote:

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.
--
hjemmehososs

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help ( Hope i made it clear this time) Tia[_3_] Excel Worksheet Functions 1 July 24th 08 11:33 AM
auto update of date and time whenever changes are made to a xcel s saran Excel Worksheet Functions 2 June 24th 08 01:39 AM
auto update of date and time whenever changes are made to a xcel s saran Excel Worksheet Functions 9 June 23rd 08 02:44 PM
Formula that will record the time and date when an entry is made on a sheet [email protected] Excel Worksheet Functions 3 October 11th 07 08:28 AM
WIZARD ARE YOU READY - UPDATING EXCEL FROM ACCESS IN REAL TIME sal21 Excel Programming 8 November 9th 04 01:53 PM


All times are GMT +1. The time now is 02:41 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"