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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default 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


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
comboboxes [email protected] uk Excel Discussion (Misc queries) 1 December 6th 09 05:07 PM
Comboboxes mr-bear New Users to Excel 1 November 21st 06 10:05 AM
Need help with ComboBoxes. rosemary New Users to Excel 2 July 9th 05 12:19 AM
ComboBoxes and Formulas excel user Excel Programming 2 October 1st 03 01:57 PM
Comboboxes David W[_3_] Excel Programming 1 August 29th 03 11:13 PM


All times are GMT +1. The time now is 10:02 PM.

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"