Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can a userform pass an argument? smokiibear Excel Programming 12 December 8th 04 02:14 AM
Userform List Boxes Load Very Slowly Stratuser Excel Programming 2 September 24th 04 08:24 PM
How to pass values from a userform to a standard module? TBA[_2_] Excel Programming 3 January 7th 04 01:50 PM
Populate Userform text boxes in VBA with VLookup data from #2 worksheet Laz[_2_] Excel Programming 4 October 8th 03 02:15 AM
How to pass arguments from ThisWorkbook to a UserForm strataguru[_4_] Excel Programming 1 October 7th 03 11:29 PM


All times are GMT +1. The time now is 05:29 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"