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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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,214,919
Messages
6,122,260
Members
449,075
Latest member
staticfluids

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