ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Reading values from inputbox into arrays (https://www.excelbanter.com/excel-programming/415851-reading-values-inputbox-into-arrays.html)

Nayab

Reading values from inputbox into arrays
 
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

Gary''s Student

Reading values from inputbox into arrays
 
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

--
Gary''s Student - gsnu2007k


"Nayab" wrote:

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


Nayab

Reading values from inputbox into arrays
 
On Aug 19, 2:27*pm, Gary''s Student
wrote:
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

--
Gary''s Student - gsnu2007k



"Nayab" wrote:
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- Hide quoted text -


- Show quoted text -


hmmm I also think I will need to parse the string. Anyway thanks a lot.


All times are GMT +1. The time now is 01:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com