how to split this time format? 5:03:18 PM

earp_

Active Member
Joined
Apr 30, 2008
Messages
305
I want to split this time format
5:03:00 PM
so after that I can update this statement
If .Value >= TimeSerial(9, 0, 0) And .Value < TimeSerial(9, 5, 0) Then

in something like
If .Value >= TimeSerial(myH1, myM1, 0) And .Value < TimeSerial(myH2, myM2, 0) Then

How can I split the time?
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Richard Schollar

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

Why do you need to split it up? You can return each element (if that is what you want to do) by using the Hour(), Minute() and Second() functions eg:

Code:
lngSeconds = Seconds(TimeValue)
 
Upvote 0

Forum statistics

Threads
1,191,592
Messages
5,987,530
Members
440,099
Latest member
wai2kit

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