InputBox entries & advice
Hi Howard,
Am Sun, 14 Jul 2013 08:44:14 -0700 (PDT) schrieb Howard:
What is the proper Type if the input data in an input box is as follows, is this a string or an array? The individual characters will later be used as numbers in a If c.value = OneOfTheseNumbers Then
Entries could be:
1,9
1,2,3,11,6,13
6
it is Type:=3 = number (1) + text(2)
And how can I take this "set" of entries from the InputBox and list them in a column as individual numbers. (That range will be Dim IndexLibary As Range("XX:YY")in the code)
try:
Sub Test()
Dim strIn As String
Dim varOut As Variant
Dim myCount As Integer
strIn = Application.InputBox("Enter one number or " _
& "more numbers comma delimited", Type:=3)
myCount = Len(strIn) - _
Len(WorksheetFunction.Substitute(strIn, ",", ""))
If myCount = 0 Then
[A1] = strIn
Else
varOut = Split(strIn, ",")
Cells(1, 1).Resize(myCount + 1, 1) = _
WorksheetFunction.Transpose(varOut)
End If
End Sub
Regards
Claus B.
--
Win XP PRof SP2 / Vista Ultimate SP2
Office 2003 SP2 /2007 Ultimate SP2
|