Cells Time formatting

Ploom

New Member
Joined
Feb 28, 2016
Messages
28
Hi,
I have a pb with the cells formatting for a time:
In a cell let's say A1, i would put a time, for ex: 08:00 and I would like to retrieve this value for the use of an Application.OnTime function
However excel considers my 08:00 as 0.3333. I tried to format my cell A1 in time category but it doesn't change anything and when i try a timevalue i have a mismatch error.
Could someone give me some pieces of advice?
Thanks a lot
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Dates and times are stored as a number. The integer part represents the date and the decimal part indicates the time. Since one day is 24 hours it means that 08:00 is one third of the way through the day or 0.3333 as you've seen. If you change it to 16:00 that you'll get 0.6666 and 12:00 would be 0.5 etc.

Having said that, you can use the cell value directly:

Code:
Application.OnTime Range("A1").Value, "MyProcedure"

This will run your procedure at 08:00 in your case.

WBD
 
Upvote 0
Thanks a lot!
Yes i could use my range directly, thanks, i forgot about this conversion, and i saw somwhere they used timevalue and got confused
Thanks for your help!
 
Upvote 0

Forum statistics

Threads
1,223,234
Messages
6,170,891
Members
452,366
Latest member
TePunaBloke

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