Happy sunday everybody!
I am new to vba and I am trying to create a deck of 40 cards (mazzo2), with suits (seme) and values (valore):
The problem is, after the last "Next" instruction I get error "Subscript out of range"......can someone help me to understand why?
Thank you!
I am new to vba and I am trying to create a deck of 40 cards (mazzo2), with suits (seme) and values (valore):
Code:
Function NtoCarta40() As String
Dim seme(1 To 40) As String, valore(1 To 40) As Long, i As Long, mazzo2(1 To 40) As String
For i = 1 To 40
Select Case i
Case i = 1 To 10
seme(i) = "C"
Case i = 11 To 20
seme(i) = "P"
Case i = 21 To 30
seme(i) = "Q"
Case i = 31 To 40
seme(i) = "F"
End Select
Next
For i = 1 To 40
Select Case i
Case i = 1 To 10
valore(i) = i
Case i = 11 To 20
valore(i) = i - 10
Case i = 21 To 30
valore(i) = i - 20
Case i = 31 To 40
valore(i) = i - 30
End Select
Next
For i = 1 To 40
mazzo2(i) = valore(i) & " " & seme(i)
Next
NtoCarta40 = mazzo2(i)
End Function
The problem is, after the last "Next" instruction I get error "Subscript out of range"......can someone help me to understand why?
Thank you!