I recently came across this bit of code inside a book I read:

Sub Shuffle_Cards()
Dim CardUsed(52) As Integer
Dim J As Integer
Call N_Integers(52, CardUsed())
For J = 1 to 52
Select Case (CardUsed(J) - 1) Mod 13 + 1
Case 1
CardName(J) = "A"
CardValue(J) = 1
Case 2
CardName(J) = "2"
CardValue(J) = 2
Case 3
CardName(J) = "3"
CardValue(J) = 3
Case 4
CardName(J) = "4"
CardValue(J) = 4
Case 5
CardName(J) = "5"
CardValue(J) = 5
Case 6
CardName(J) = "6"
CardValue(J) = 6
Case 7
CardName(J) = "7"
CardValue(J) = 7
Case 8
CardName(J) = "8"
CardValue(J) = 8
Case 9
CardName(J) = "9"
CardValue(J) = 9
Case 10
CardName(J) = "10"
CardValue(J) = 10
Case 11
CardName(J) = "J"
CardValue(J) = 10
Case 12
CardName(J) = "Q"
CardValue(J) = 10
Case 13
CardName(J) = "K"
CardValue(J) = 10
End Select
CardSuit(J) = Int((CardUsed(J) - 1) / 13)
Next J
CurrentCard = 1
End Sub

I want to use a similar sorting algorithm with a control array. I put in this code:

Sub Shuffle_Cards()
Dim CardUsed(15) As Integer
Dim CardsLeft As Integer
Dim J As Integer
Call N_Integers(15, CardUsed())
For J = 1 To 15
Select Case (CardUsed(J) - 1) Mod 15 + 1
Case 1 To 5
picNumber(Index).Picture = LoadPicture(App.Path + "\images\plus250.jpg")
Case 6 To 10
picNumber(Index).Picture = LoadPicture(App.Path + "\images\plus500.jpg")
Case 11 To 15
picNumber(Index).Picture = LoadPicture(App.Path + "\images\plus750.jpg")
End Select
CardsLeft(J) = Int((CardUsed(J) - 1) / 15)
Next J

Whoops, there's a problem: VB says the Index variable is undefined. How could I use this for a control array? I'd simply undo the control array, except I'd have about 50 picture boxes to write code for.