LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default 2 Listbox's not working

I have a macro with 2 listboxes that I want to use for selecting values from
2 lists. The main macro shows both lists sequentially and then uses the 2
selected values to process data. Unfortunately when certain values in the
first list are selected, the 2nd list box is not displayed but the main macro
code continues as if a val;ue from the 2nd list had been selected.

Below is the code in which the same form is used for both lists. I tried
using two separate forms but that didn't help. If I uncomment the msgbox code
in the init routine, the lists work properly.

Column A has values a,b,c,d,e,blank and column b has values 1,2,3, blank

======================

Private Sub ListBox1_Click()
poolName = ListBox1.Value
Unload Me
End Sub

Private Sub userform_initialize()

'MsgBox "form 1 init"

Windows("InvoiceMacro.xls").Activate

Sheets("Lists").Select

If listnum = 1 Then Range("a1").Select Else Range("b1").Select

Do Until ActiveCell.Value = ""
ListBox1.AddItem (ActiveCell.Value)
ActiveCell.Offset(1, 0).Select
Loop

End Sub
Private Sub UserForm_Click()

End Sub


++++ main macro

Sub doboth()

listnum = 1
frmListbox1.Show


listnum = 2
frmListbox1.Show


End Sub



 
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
Calculate working days but change working week SamB Excel Discussion (Misc queries) 1 September 1st 08 09:17 PM
Making weekend days working days - the system cuts the working tim Fluffy Excel Discussion (Misc queries) 1 May 30th 08 10:02 PM
Listbox's and retaining data when closing eklarsen[_6_] Excel Programming 0 May 7th 04 05:25 AM
LISTBOX'S GREGORY Excel Programming 3 December 1st 03 01:50 PM
Adding sales from a non working day to the previous working day Alex Excel Programming 1 September 19th 03 08:48 AM


All times are GMT +1. The time now is 06:14 AM.

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

About Us

"It's about Microsoft Excel"