Reading values from inputbox into arrays

  • Thread starter Thread starter Nayab
  • Start date Start date
N

Nayab

Is it possible to read the values from inputbox directly into arrays?
The values may be comma-separated or space-separated.

The initial problem is I want to exclude certain sheets from
processing based on user's input. So I display the msg showing all the
sheet names to the user and if the user chooses to exclude some of the
sheets, I plan to ask for the sheet names to be excluded which I plan
to put in an array and use the array for further processing.

Thanks
 
1. read the list into a string
2. parse the string into an array

Sub nayab()
Dim s As String
s = Application.InputBox(prompt:="Enter list: ", Type:=2)
listt = Split(s, ",")

For i = 0 To UBound(listt)
MsgBox (listt(i))
Next
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top