Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pass Data from List Boxes in Userform
I have a Userform with 2 List boxes. Listbox1 loads all
the sheet names of the current workbook into it. The user is then given the choice of ignorning certain worksheets. The user chooses sheet names from Listbox1 and uses an ADD button to transfer these names into Listbox2. The user then clicks on OK to continue. This all works well. I want to be able to create an array that summarizes which sheets are of interest and not of interest. I want to pull all the sheets names into an 2D array. I want the first column to have the sheet names and the second column to have a 1 (Interest) or 0 (Not Interested). So my questiona a 1) Where do I create this array? Is it in the OKButton click Event? 2) I am effectively doing a lookup on the first column values in my array (Sheet names) on the values in Listbox 2. I am not sure how to lookup a single value (from an array) in a listbox. TotalSheets = ListBox1.Items.Count For X = 1 to TotalSheets If Array(0,X-1) = ListBox2.?????? Then Array(1,X-1) = 0 Else: Array(1,X-1) = 1 End if Next X Does anybody know how to do this. Thank-U |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Pass Data from List Boxes in Userform
For X = 1 to TotalSheets
Array(1,X-1) = 1 for k = 0 to Listbox2.Listcount-1 if Listbox2.list(k) = Array(0,X-1) Then Array(1,X-1) = 0 exit for end if Next Next X -- Regards, Tom Ogilvy "ExcelMonkey" wrote in message ... I have a Userform with 2 List boxes. Listbox1 loads all the sheet names of the current workbook into it. The user is then given the choice of ignorning certain worksheets. The user chooses sheet names from Listbox1 and uses an ADD button to transfer these names into Listbox2. The user then clicks on OK to continue. This all works well. I want to be able to create an array that summarizes which sheets are of interest and not of interest. I want to pull all the sheets names into an 2D array. I want the first column to have the sheet names and the second column to have a 1 (Interest) or 0 (Not Interested). So my questiona a 1) Where do I create this array? Is it in the OKButton click Event? 2) I am effectively doing a lookup on the first column values in my array (Sheet names) on the values in Listbox 2. I am not sure how to lookup a single value (from an array) in a listbox. TotalSheets = ListBox1.Items.Count For X = 1 to TotalSheets If Array(0,X-1) = ListBox2.?????? Then Array(1,X-1) = 0 Else: Array(1,X-1) = 1 End if Next X Does anybody know how to do this. Thank-U |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
can a userform pass an argument? | Excel Programming | |||
Userform List Boxes Load Very Slowly | Excel Programming | |||
How to pass values from a userform to a standard module? | Excel Programming | |||
Populate Userform text boxes in VBA with VLookup data from #2 worksheet | Excel Programming | |||
How to pass arguments from ThisWorkbook to a UserForm | Excel Programming |