ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with ComboBox in VBA (https://www.excelbanter.com/excel-programming/426374-help-combobox-vba.html)

Ayo

Help with ComboBox in VBA
 
I have form with 2 ComboBoxes (Market and Phase), 1 Frame with 3
OptionButtons (Today, Tomorrow, Both). I am trying to set up a process where
all the controls on the form are disabled except for Market.
When a value is selected for Market, Phase becomes enabled.
When a value is selected for Phase, the frame and all the OptionButtons
becomes enabled.

Now if I go into the Phase ComboBox and manually delete the value in it, I
want the frame and all the OptionButtons to become disabled. How do I do
this? So far all I have is this:

Private Sub cmbPhase_Change()
If Not IsNull(Me.cmbPhase.Text) Then
Me.frmReport.Enabled = True
Me.optBoth.Enabled = True
Me.optToday.Enabled = True
Me.optTomorrow.Enabled = True
ElseIf IsNull(Me.cmbMarket.Text) Then
Me.frmReport.Enabled = False
Me.optBoth.Enabled = False
Me.optToday.Enabled = False
Me.optTomorrow.Enabled = False
End If
End Sub

Any help will be greatly appreciated.
Thanks
Ayo


JLGWhiz[_2_]

Help with ComboBox in VBA
 
Would hiding and unhiding the controls work just as well?

In the form initialize event, hide the phase combobox and the frame. When
the Market combobox is clicked, use the click event code to unhide the phase
combobox. When the phase combox is clicked, use the click event code to
unhide the frame.


"Ayo" wrote in message
...
I have form with 2 ComboBoxes (Market and Phase), 1 Frame with 3
OptionButtons (Today, Tomorrow, Both). I am trying to set up a process
where
all the controls on the form are disabled except for Market.
When a value is selected for Market, Phase becomes enabled.
When a value is selected for Phase, the frame and all the OptionButtons
becomes enabled.

Now if I go into the Phase ComboBox and manually delete the value in it, I
want the frame and all the OptionButtons to become disabled. How do I do
this? So far all I have is this:

Private Sub cmbPhase_Change()
If Not IsNull(Me.cmbPhase.Text) Then
Me.frmReport.Enabled = True
Me.optBoth.Enabled = True
Me.optToday.Enabled = True
Me.optTomorrow.Enabled = True
ElseIf IsNull(Me.cmbMarket.Text) Then
Me.frmReport.Enabled = False
Me.optBoth.Enabled = False
Me.optToday.Enabled = False
Me.optTomorrow.Enabled = False
End If
End Sub

Any help will be greatly appreciated.
Thanks
Ayo





All times are GMT +1. The time now is 12:32 AM.

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