lezawang
Well-known Member
- Joined
- Mar 27, 2016
- Messages
- 1,805
- Office Version
- 2016
- Platform
- Windows
Hi
With a help from Fluff, I created the code below. It is asking user to enter 3 numbers then the code will msg out these 3 numbers. I want to improve this code. I do not want to limit user to enter only 3 numbers. I want a user to enter any number and I will create a loop depend on how many numbers user entered. Any help would be appreciated. Thank you.
With a help from Fluff, I created the code below. It is asking user to enter 3 numbers then the code will msg out these 3 numbers. I want to improve this code. I do not want to limit user to enter only 3 numbers. I want a user to enter any number and I will create a loop depend on how many numbers user entered. Any help would be appreciated. Thank you.
Code:
' asking users to enter multiple numbers and then msgboxing them 1 by 1
Sub myarray()
Dim x As Variant
Dim i As Integer
x = InputBox("enter 3 numbers like 1,2,3")
x = Split(x, ",")
For i = 0 To 2
MsgBox "your number are " & "number" & i + 1 & ">> " & x(i)
Next i
End Sub