ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Deleting Comboboxes (https://www.excelbanter.com/excel-programming/418042-deleting-comboboxes.html)

aqualibra

Deleting Comboboxes
 
I have two sets of comboboxes.
I set has 5 comboboxes and the other has 7 comboboxes.

In the second set, first five comboboxes are the same as set 1.

If I choose set1, all the comboboxes of set 1 are seen and if I choose set
2, all the comboboxes of set 2 are seen.

Is there a way to code such that depending on what set I choose their
respective comboboxes appear. In other words, I want the two extra comboboxes
to appear and disappear depending on what set is chosen.

Thanks you

FunkySquid

Deleting Comboboxes
 
If you create 7 comboboxes and call then ComboBox1-7. Then create 2
OptionButtons and call them optSet1 and optSet2 then paste the
following code into the form.

Private Sub optSet1_Click()
If optSet1.Value = True Then
Call ChangeComboSet1Visible(True)
Call ChangeComboSet2Visible(False)
End If
End Sub

Private Sub optSet2_Click()
If optSet2.Value = True Then
Call ChangeComboSet1Visible(True)
Call ChangeComboSet2Visible(True)
End If
End Sub

Function ChangeComboSet1Visible(boolVisible As Boolean)
Me.ComboBox1.Visible = boolVisible
Me.ComboBox2.Visible = boolVisible
Me.ComboBox3.Visible = boolVisible
Me.ComboBox4.Visible = boolVisible
Me.ComboBox5.Visible = boolVisible
End Function

Function ChangeComboSet2Visible(boolVisible As Boolean)
Me.ComboBox6.Visible = boolVisible
Me.ComboBox7.Visible = boolVisible
End Function

Private Sub UserForm_Activate()
Call ChangeComboSet1Visible(False)
Call ChangeComboSet2Visible(False)
End Sub

Hope this helps.


On 3 Oct, 15:00, aqualibra
wrote:
I have two sets of comboboxes.
I set has 5 comboboxes and the other has 7 comboboxes.

In the second set, first five comboboxes are the same as set 1.

If *I choose set1, all the comboboxes of set 1 are seen and if I choose set
2, all the comboboxes of set 2 are seen.

Is there a way to code such that depending on what set I choose their
respective comboboxes appear. In other words, I want the two extra comboboxes
to appear and disappear depending on what set is chosen.

Thanks you




All times are GMT +1. The time now is 04:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com