I am creating a probability macro which has user enter an integer greater than zero. This integer then creates the same number of strings as its value (if integer is 5, 5 strings are created, then the strings "Player1", "Player2"..."Player5") are created. What is the easiest way to do this?
Right now I am using:
Sub FunctionPlayersCount()
a = 1
Dim Player(1 To Player)
Do Until a = Players
a = a + 1 ' add 1 each time, approaching Players value
Player(Player) = Player & a
MsgBox Player & a
End Sub
When I run this function I get:
Compile error:
Constant expression required
Playeris which? This is extremely poor code, reminiscent of George Foreman naming all of his male children George. When the wife says "Hey, George!", which one of them is she addressing? Her husband, her oldest child, her youngest child, or one of the several in between oldest and youngest? When you refer toPlayerinPlayer(Player) = Player, whichPlayeris which? Choose better variable names to use, such asDim Players(1 to NumPlayers), try again, and then come back if you have problems. You also can't reference an array using a string + a numeral. - Ken White