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

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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