Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Assigning Variables To An array Throughout a loop
Hi,
I'm trying to assign a value to an array in the following procedure and it is telling me 'Subscript out of range at the statement MyArray (i) =whichchar. How can I do this differently to continue to assign variables to this array throughout the loop? Private Sub ParseData(MyWord As String) Dim I As Integer, MyStep As Integer, LastLetter As String, NumChar As Integer, WhichChar As String Dim numOccurences As Integer, T As Integer Dim MyArray() As String MyStep = 1 I = 0 NumChar = 0 Do Until I = 1 LastLetter = Mid(MyWord, MyStep, 1) MyStep = MyStep + 1 Select Case LastLetter Case Is = "" I = I + 1 End Select DoEvents Loop NumChar = MyStep - 2 I = 1 T = 1 Do While I <= NumChar WhichChar = Mid(MyWord, I, 1) Do Until T = NumChar + 1 Select Case Mid(MyWord, T, 1) Case Is = WhichChar numoccurrences = numoccurrences + 1 T = T + 1 Case Else T = T + 1 End Select Select Case T Case Is = NumChar + 1 MyArray(I) = WhichChar Debug.Print "There are " & numoccurrences & " " & WhichChar & "'s in this word" End Select Loop T = 1 I = I + 1 numoccurrences = 0 Loop End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Assigning cell values to variables | Excel Discussion (Misc queries) | |||
Assigning Cell data to VB Variables | Excel Programming | |||
Assigning cell address components to variables | Excel Programming | |||
Assigning 10x1 array to 2nd collumn of 10x3 array | Excel Programming | |||
Assigning 10x1 array to 2nd collumn of 10x3 array | Excel Programming |