View Single Post
 
Old 12-26-2012, 02:18 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Try:
Code:
Sub q()
Dim vInput As Variant
vInput = InputBox("", "", "9.1,1,3,5,6,2,4,10,7,8")
Dim arr(), a As Long
For a = 0 To UBound(Split(vInput, ","))
  ReDim Preserve arr(a)
    arr(a) = CInt(Split(vInput, ",")(a)) '' to convert string to integer
    MsgBox arr(a) & vbTab & TypeName(arr(a))
Next a
End Sub
Hint: Storing integers as longs makes for more efficient processing, so consider:
arr(a) = CLng(Split(vInput, ",")(a))
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote