Solved

Activate only 1 combo box

Posted on 2000-03-13
5
184 Views
Last Modified: 2010-05-02
Hello,

     In Excel 97, I have a form that has 3 comboboxes.  I'd like the user to be able to choose only ONE of the combo boxes.  (I have 3 combo boxes for 3 different categories, and only 1 of those can be processed).  

     For example, if the user chose a selection in combobox 1, but then also tried to select something in combobox 2, combobox 1 would be DESELECTED, and the new choise (combobox2) is the new selection.

     Does anyone have the work around for this?  
   Thank you!!!
0
Comment
Question by:mlouie23
  • 2
  • 2
5 Comments
 
LVL 6

Expert Comment

by:Marine
ID: 2614451
I never did VBA but here is a thought. Create a Control Array and depnding on the ComboBox selected disable the other 2.
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 25 total points
ID: 2614586
The first item of the combobox reads something like "Select from list."  Then, with this code, if a selection is made in any of the combos, the others will reset to index 0 (top of list).

Private Sub Combo1_Click()
    If Combo1.ListIndex <> 0 Then
        'Reset all other combos
        Combo2.ListIndex = 0
        Combo3.ListIndex = 0
    End If
End Sub

Private Sub Combo2_Click()
    If Combo2.ListIndex <> 0 Then
        'Reset all other combos
        Combo1.ListIndex = 0
        Combo3.ListIndex = 0
    End If
End Sub

Private Sub Combo3_Click()
    If Combo3.ListIndex <> 0 Then
        'Reset all other combos
        Combo1.ListIndex = 0
        Combo2.ListIndex = 0
    End If
End Sub
0
 

Author Comment

by:mlouie23
ID: 2614700
Adjusted points from 15 to 25
0
 

Author Comment

by:mlouie23
ID: 2614701
Erik37,

    Great...thanks so much for helping me with these combo boxes.  I really appreciate it.  I want to award you more points for such a great solution, but bumping it up to 25 is all I could afford right now.  

Thank you!
0
 
LVL 32

Expert Comment

by:Erick37
ID: 2614719
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question