Splitting up an array

I have an unknown sized string array (always different size) and I’m trying to split it in chunks of 50. I think it I have it now but I’m guessing there’s an easier way.

[code] Dim s() As String
Dim s1() As String /Just to make a sample of the array I want to split up
For c As Integer = 0 to 108 //This number could be anything from 0 to 50,000
s.Append str©

Dim u As Integer = Ceil(UBound(s)/50)
u = u -1
For c As Integer = 0 to u
Dim upp As Integer
Dim c1 As Integer = 50*c
If c = u then
upp = UBound(s)
upp = c1 + 49
End If

Redim s1(-1)
For c2 As Integer = c1 to upp
  s1.Append s(c2)
  //do work on s1



How about

c2 = 0
while c2 <= Ubound(s)
   redim s1(-1)
   for c1 = 1 to 50
      s1.append s(c2)
      c2 = c2 + 1
      if c2> Ubound(s) then exit for
   // do work on s1

Yup makes total sense :slight_smile: