Hi everyone,

i really need some help on this situation. i load a text file which contains several lines (items), let's say 231 items, into an array named strMainItems. After that i want to split that strMainItems into several arrays named strItemA, strItemB and so on which contains 100 items per array. so with my code the result will like this:

strMainItems = 0 - 230
strItemA = 0 - 99
strItemB = 100 - 199
strItemC = 200 - 230

but i don't want them to be like that. i want each array has an index start from 0, like this:

strItemA = 0 - 99
strItemB = 0 - 99
strItemC = 0 - 30

how can i do that? and what if the text file contains bigger items, say like 531. if so, then i have to make as many variable as needed (strItemA, strItemB, strItemC, strItemD, strItemE, strItemF til enough) manually..

this is my code:

Code:
Option Explicit

Dim strItemA(0 To 99) As String
Dim strItemB(100 To 199) As String
Dim strItemC(200 To 230) As String

Private Sub Command1_Click()
    Dim iFile As Integer
    Dim strMainItems() As String
    Dim i As Long
    iFile = FreeFile
    Open "friends.txt" For Input As iFile
    strMainItems = Split(Input$(LOF(iFile), iFile), vbCrLf)
    
    For i = 0 To 99
        strItemA(i) = strMainItems(i)
    Next i
    
    For i = 100 To 199
        strItemB(i) = strMainItems(i)
    Next i

    For i = 200 To 230
        strItemC(i) = strMainItems(i)
    Next i
    
    Close iFile
End Sub
and i guess the idea to load a text file first into strMainItems is not good if it can be done by directly load those items into strItemA, strItemB, strItemC and so on.. but i don't know how..

thank you very much..