Hiding OLEObjects based on data validation on a different worksheet

AwesomeSteph

Board Regular
Joined
Aug 18, 2017
Messages
80
Hi I have run into a roadblock that I just can't figure out, I would really appreciate any help I can get.

On sheet 2 in B2 there is a data validation drop down list that has 6 different options. What I need to happen is that on sheets 6, 8, and 9 for an embedded word doc "Object 1" to be visible unless one specific option is chosen lets call it "XYZ" in that case I need "Object 2" to be visible and "Object 1" to not be visible. So far what I have works for the first part but the second part that should be anything else other then "XYZ" does not hide object 2 and both are visible.

Sheet2 B2 = XYZ = only object 2 visible object 1 hidden
Sheet2 B2 = not XYZ = only object 1 visible object 2 hidden

Please help.

<code><code>
Private Sub Worksheet_SelectionChange(ByVal target As Range)
Application.ScreenUpdating = False

If Sheet2.Range("B2") = "XYZ" Then
ActiveSheet.OLEObjects("Object 1").Visible = False
ActiveSheet.OLEObjects("Object 2").Visible = True
Else
ActiveSheet.OLEObjects("Object 1").Visible = True
ActiveSheet.OLEObjects("Object 2").Visible = False
End If


Application.ScreenUpdating = True
End Sub
</code></code>
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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