Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am using Excel 2002. I have created a form with 4 listboxes all
populated with For..Next loops during the Userform Initialize procedure. I then select an item in each listbox using listbox1.listindex = xx. I then try to access the selected items using listbox.text and display the results in a message box. I only receive the correct answer for two listboxes. The other two listboxes (not always the same two listboxes) appear to be empty. (See example code below.) Private Sub UserForm_Initialize() Dim x As Integer For x = 1 To 50 With ListBox1 .AddItem "Number " & x End With Next x For x = 1 To 50 With ListBox2 .AddItem "Number " & x End With Next x For x = 1 To 50 With ListBox3 .AddItem "Number " & x End With Next x For x = 1 To 50 With ListBox4 .AddItem "Number " & x End With Next x With UserForm1 .ListBox1.ListIndex = 30 .ListBox2.ListIndex = 31 .ListBox3.ListIndex = 32 .ListBox4.ListIndex = 33 End With MsgBox "Box 1 = " & ListBox1.Text & Chr(13) & "Box 2 = " & ListBox2.Text & Chr(13) MsgBox "Box 3 = " & ListBox3.Text & Chr(13) & "Box 4 = " & ListBox4.Text & Chr(13) End Sub Any help would be greatly appreciated. ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~ View and post usenet messages directly from http://www.ExcelForum.com/ |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
If function not working correctly | Excel Discussion (Misc queries) | |||
Filters not working correctly | Setting up and Configuration of Excel | |||
VLookup is not working correctly | Excel Worksheet Functions | |||
Wrap Text is not working correctly on one persons computer | Excel Discussion (Misc queries) | |||
Text to Columns not working correctly with dates in Excel 2007 | Excel Discussion (Misc queries) |