LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Assigning cell values to variables Tim Excel Discussion (Misc queries) 3 June 11th 09 04:30 PM
Assigning Cell data to VB Variables [email protected] Excel Programming 3 March 29th 07 04:53 AM
Assigning cell address components to variables Conan Kelly Excel Programming 1 June 15th 05 06:05 AM
Assigning 10x1 array to 2nd collumn of 10x3 array Alan Beban[_2_] Excel Programming 0 July 30th 04 01:38 AM
Assigning 10x1 array to 2nd collumn of 10x3 array Myrna Larson Excel Programming 0 July 29th 04 11:57 PM


All times are GMT +1. The time now is 10:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"