System time? -SOLVED-

Jouve

New Member
Joined
Aug 10, 2006
Messages
19
Hello,

i would like to have a macro (visual basic), that gives time (system time) as output.

anybody knows?

thanks.


PS : sorry for the stupid question, have found the answer already by now :)
it's "Time" and "Date"
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Hi Jouve

Glad you found a solution! You might want want to Edit the subject line of your post to indicate you have solved your issue. Eg Subject Line:

SOLVED - System time?

Best regards

Richard
 

Jouve

New Member
Joined
Aug 10, 2006
Messages
19
i'm having other problems here...

if i try to do this from new excel sheet, it works fine, but if i try to implement this macro on other existing excel file, error "Fehler beim kompilieren: Projekt oder Bibliothek nicht gefunden"

translated would be like :
Error on compilation, Project or Library not found

any help?
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
How are you using Time and Date? Something like:

Code:
Sub Test
ThisWorkbook.Sheets("Sheet1").Range("A1") = Date
ThisWorkbook.Sheets("Sheet1").Range("A2") = Time
End Sub

Try going Tools>References and see if you have any marked as MISSING. Alternatively, call the functions as:

Code:
Sub Test
ThisWorkbook.Sheets("Sheet1").Range("A1") = VBA.Date
ThisWorkbook.Sheets("Sheet1").Range("A2") = VBA.Time
End Sub

and see if this makes a difference.

Best regards

Richard
 

Jouve

New Member
Joined
Aug 10, 2006
Messages
19

ADVERTISEMENT

Thanks for your suggestion, but what im having as an output is :

Date 38.992,00
Time 0,62

judging from the time, its 14:47 here. does this 0,62 means im 62% through with today? how can i convert the day/time?
 

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
Yep:

Code:
Range("A1") = Format(Date,"dd-mmmm-yyyy")
Range("A2") = Format(Time,"hh:mm")

you can change the exact format using the Format function.

Best regards

Richard
 

Jouve

New Member
Joined
Aug 10, 2006
Messages
19
it works!

much thanks for your help, i really appreciate it.
 

Forum statistics

Threads
1,136,592
Messages
5,676,690
Members
419,644
Latest member
KeelsM

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top