I just have tghis var
...
Dim DA As Date, A As Date
DA = Format(RS.Fields(0).Value, "HH:MM")
A = Format(RS.Fields(1).Value, "HH:MM")
...
for example:
DA=07:00
A=09:30
How to create a list oh time with a step of 30 minutes
to the and i need
07:00
07:30
08:00
08:30
09:00
09:30
NOTE:
if my setting o var are wrong other way are welcome
the filed are setting with data breve
STEP hour and minutes
-
- Administrator
- Posts: 78457
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: STEP hour and minutes
Code: Select all
Dim D As Date
For D = DA To A Step TimeSerial(0, 30, 0)
' Do something with the value of D, for example:
Debug.Print D
Next D
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4354
- Joined: 26 Apr 2010, 17:36
Re: STEP hour and minutes
HUMMM...HansV wrote: ↑28 Mar 2022, 11:00Code: Select all
Dim D As Date For D = DA To A Step TimeSerial(0, 30, 0) ' Do something with the value of D, for example: Debug.Print D Next D
for DA=19:00 and A=21:30
the loop stop to 21:00, possible
-
- Administrator
- Posts: 78457
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: STEP hour and minutes
This is due to rounding errors. As a workaround:
Code: Select all
Dim D As Date
For D = DA To A + 0.000001 Step TimeSerial(0, 30, 0)
Debug.Print D
Next D
Best wishes,
Hans
Hans