B
Bill Grigg
Dear MS,
I have done a fair amount of Excel VBA programming, but this is a new odd
behavior. I have a form with 3 listboxes. All 3 listboxes have a range as a
Rowsource. When the form opens they are all populated and display just fine.
I want an item selected in the first listbox to force the same selection
(i.e. listindex) in the other 2 listboxes. In the listbox1_Click()
subroutine I put the following code:
listbox2.ListIndex = listbox1.ListIndex
listbox3.ListIndex = listbox1.ListIndex
v1 = listbox1.Value (or .Text)
v2 = listbox2.Value (or .Text)
v3 = listbox3.Value (or .Text)
v1 and v2 have the right stuff but v3 = ""
Here is another twist, in
UserForm_Activate() I do:
ListBox1.ListIndex = 0
This of course triggers ListBox1_Click(). The form shows all three listboxes
with the first item (listindex = 0) selected. However, Listbox1.Text 1 and
ListBox3.Text are empty and Listbox2 is correct. If I then follow that bny
clicking on ListBox1, ListBox1.Text and ListBox2.Text are correct, but
ListBox3.Text is empty
Any ideas?
TIA,
Bill
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/communitie...65c246b&dg=microsoft.public.excel.programming
I have done a fair amount of Excel VBA programming, but this is a new odd
behavior. I have a form with 3 listboxes. All 3 listboxes have a range as a
Rowsource. When the form opens they are all populated and display just fine.
I want an item selected in the first listbox to force the same selection
(i.e. listindex) in the other 2 listboxes. In the listbox1_Click()
subroutine I put the following code:
listbox2.ListIndex = listbox1.ListIndex
listbox3.ListIndex = listbox1.ListIndex
v1 = listbox1.Value (or .Text)
v2 = listbox2.Value (or .Text)
v3 = listbox3.Value (or .Text)
v1 and v2 have the right stuff but v3 = ""
Here is another twist, in
UserForm_Activate() I do:
ListBox1.ListIndex = 0
This of course triggers ListBox1_Click(). The form shows all three listboxes
with the first item (listindex = 0) selected. However, Listbox1.Text 1 and
ListBox3.Text are empty and Listbox2 is correct. If I then follow that bny
clicking on ListBox1, ListBox1.Text and ListBox2.Text are correct, but
ListBox3.Text is empty
Any ideas?
TIA,
Bill
----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.
http://www.microsoft.com/communitie...65c246b&dg=microsoft.public.excel.programming