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

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
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
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,213,554
Messages
6,114,280
Members
448,562
Latest member
Flashbond

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
Back
Top