• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

fill first column of flex grid with 15 minute increments - how to loop through

I am going to pass two parameters to my fill loop routine - the first value is 800, which represents 8:00 , and is my starting time, and the second value, which which will represent my ending time, is going to be 1700, in military time.

I need to start with the first parameter and, adding 15 minute increments and go until I reach the ending parameter.

So my column in flex grid will look like this:

08:00
08:15
08:30
08:45
09:00

and so on to the ending parameter - which is 17:00.

Could someone put together a snippet of code on an easy way to do this - to fill each column, incrementing by 15 minutes from the start parameter to the end parameter.

Thanks in advance.


0
samic400
Asked:
samic400
  • 2
1 Solution
 
FER_GCommented:
try the next code snippet and let us know if it is that you need...

Regards.
FerG
Saludos
--
Ing. Fernando D. Giletta
MP: 4035 CIEC
San Fco. Cba. Arg.

Private Sub llenarGrilla(iniTime As Date, endTime As Date, interval As Integer)
    Dim actTime As Date
    actTime = iniTime
    With grilla
        .Rows = 1
            
        Do Until actTime >= endTime
            .AddItem actTime
            actTime = DateAdd("n", interval, actTime)
        Loop
        
    End With
End Sub
 
Private Sub cmd1_Click()
    Call llenarGrilla("08:00:00", "17:00:00", 15)
End Sub

Open in new window

0
 
samic400Author Commented:
thank you - exactly what i was looking for.
0
 
FER_GCommented:
you're welcome, i'm glad to help you!

Regards.
FerG
Saludos
--
Ing. Fernando D. Giletta
MP: 4035 CIEC
San Fco. Cba. Arg.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now