Conditionally Show/Hide ComboBox Based on Cell Value

Mayanwolfe

New Member
Joined
Jun 5, 2013
Messages
27
Hi, I'm quite new to VBA, but I am attempting to get a Forms ComboBox to appear or disappear based on whether a certain cell (P7) reads YES or NO. P7 in turn updates in turn based on a user-selected value. As of now, the ComboBox only appears or disppears if I go back in and out of the formula I entered into P7. Basically, I want my ComboBox to dynamically update based on the value in P7. That may sound a little muddled, so here is my code for the ComboBox:

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
 
    If Not Intersect(Target, Range("P7")) Is Nothing Then
         If UCase(Target) = "YES" Then
             Me.Shapes.Range("Drop Down 30").Visible = msoTrue
         Else
             Me.Shapes.Range("Drop Down 30").Visible = msoFalse
         End If
     End If
 
End Sub

Thanks in advance for your help.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
the Change event is not triggered by changes in formula results.
In your code,
If Not Intersect(Target, Range("P7")) Is Nothing Then
change the Range("P7") part to the cell(s) which the user changes.
Also change the:
If UCase(Target) = "YES" Then
to:
If Range("P7") = "YES" Then
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top