Date not cycling with addition of time

Cummins

Board Regular
Joined
Jul 26, 2011
Messages
58
Trying to figure out issue with adding date and time.
The code is listed below.
I have watched the code while running. The initial date FDateS and FDate(t) value is m/dd/yyyy (9/16/2010) and no time. FDateS has different amounts of time added to it. The issue I have encountered is that once it passes midnight, the date does not change but the time reflects the change to 00:00:00.

Public FDate(1000) As Date
Public FTime(1000) As Date


FDate(t) = CDate(Mid(FindData("sm_Sys_BatchOpenTime"), 1, 10))

For H1 = 1 To n
FDateS = FDate(H1)
For r =1 to 50
FDateS = CDate(FDateS) + CDate(FTime(r)-Ftime(r-1))
Next
Next
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Want to add some clarification...here is the output I am concerned with

9/16/2010 23:00
9/16/2010 23:30
9/16/2010 0:00
9/16/2010 0:30
9/16/2010 1:00
9/16/2010 1:30

It is as if the date is a string instead of a value.
 
Upvote 0

Forum statistics

Threads
1,224,317
Messages
6,177,850
Members
452,810
Latest member
jeffrey0409

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