![]() |
Several comboBoxes on a Userform
Hello
I have a Userform with 5 ComboBoxes names "ComboBox1" to "ComboBox5". Each of them is loaded with the same data base. When I make a choice in a Combo, I have to control the entry. How can I make a routine to know which of the five has been selected and to get the selection. I tried to use a Class Module but unsuccesfully: Exit method doesn't operate. Thanks for helping me. |
Several comboBoxes on a Userform
I have a Userform with 5 ComboBoxes names "ComboBox1" to "ComboBox5".
How can I make a routine to know which of the five has been selected and to get the selection. This should get you started. If c.ListIndex = -1, the ComboBox hasn't been selected. If the ComboBox has been selected, then c.Value will show the value. HTH, Merjet Private Sub UserForm_Click() Dim c As Control For Each c In Me.Controls If TypeName(c) = "ComboBox" Then MsgBox c.Name & " " & c.ListIndex & " " & c.Value End If Next c End Sub |
Several comboBoxes on a Userform
Hi Merjet, thanks for your answer
Your proposal is right, but I don't use the Userform_Click event. I only skip from one ComboBox to an other. My problem is to find which ComboBox has just been used to verify if the selection is got from the data base or is a new element. I must do that each time I leave a ComboBox. Regards Michel "merjet" a écrit dans le message news: 7eEeb.646593$YN5.496747@sccrnsc01... I have a Userform with 5 ComboBoxes names "ComboBox1" to "ComboBox5". How can I make a routine to know which of the five has been selected and to get the selection. This should get you started. If c.ListIndex = -1, the ComboBox hasn't been selected. If the ComboBox has been selected, then c.Value will show the value. HTH, Merjet Private Sub UserForm_Click() Dim c As Control For Each c In Me.Controls If TypeName(c) = "ComboBox" Then MsgBox c.Name & " " & c.ListIndex & " " & c.Value End If Next c End Sub |
Several comboBoxes on a Userform
Your proposal is right, but I don't use the Userform_Click event. I only
skip from one ComboBox to an other. My problem is to find which ComboBox has just been used to verify if the selection is got from the data base or is a new element. I must do that each time I leave a ComboBox. Then move the code (w/o 1st & last lines) to another procedure where you do want it. HTH, Merjet |
All times are GMT +1. The time now is 10:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com