insert every time value 15 minutes in array

Hi,

Please kindly assist how can we insert every 15 minutes into an array?

Thanks.

output:
Arr_TimeValuesPer15=00:00 AM,00:15 AM,00:30 AM,00:45 AM,01:00 AM,01:15 AM,01:30 AM,......11:45 PM


Dim Arr_TimeValuesPer15() as string
redim preserve Arr_TimeValuesPer15(ubound(Arr_TimeValuesPer15)+95)

for i=0 to ubound(Arr_TimeValuesPer15)
Arr_TimeValuesPer15=format(time(),"hh:mm:pm")+15minutes
next i


RyanBankAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Dim Arr_TimeValuesPer15() as string
dim d as date
redim preserve Arr_TimeValuesPer15(ubound(Arr_TimeValuesPer15)+95)

d = 0
for i=0 to ubound(Arr_TimeValuesPer15)
  d= dateadd("n", 15)
  Arr_TimeValuesPer15=format(d,"hh:mm:pm")
next i
0
 
RyanBankAuthor Commented:
Thanks worked like a charm!

Dim Arr_TimeValuesPer15() As String
Dim d As Date
ReDim Preserve Arr_TimeValuesPer15(95)

d = 0
For i = 0 To UBound(Arr_TimeValuesPer15)
 
  Arr_TimeValuesPer15(i) = Format(d, "hh:mmAM/PM")
  d = DateAdd("n", 15, d)
Next i

Debug.Print Join(Arr_TimeValuesPer15, ",")

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.