I have 2 validations. 1 for Tanks, 1 for Reactors, when we pick the item id like to show the corresponding Shape.
The shapes are named as Numbers.
I need to clear any showing shape of a Tank and only show the chosen validation item,
Same for Reactors.
101 to 131 are Tanks and between 201 to 403 are Reactors
This is an idea that doesnt work.
myTnk are a list of named shapes that I want to hide or show when a data validation drop down choice is picked.
This code is attempting to hide everything.
The below works but seems clunky and I have another section that has many more entries. wanting to simplify with a loop or something else
another attempt to hide shapes named a number higher than 200... fail
Any help is appreciated
Mark
The shapes are named as Numbers.
I need to clear any showing shape of a Tank and only show the chosen validation item,
Same for Reactors.
101 to 131 are Tanks and between 201 to 403 are Reactors
VBA Code:
Sub ActivateTank()
Dim mapSht As Worksheet
Dim myShp As Shape
Dim myTnk As String
myTnk = "101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 126, 127, 130, 131"
Set mapSht = Worksheets("Campus")
With mapSht
For Each myShp In myTnk
ActiveSheet.Shapes.Range(Array(" & myTnk & ")).Visible = False
Next myShp
End With
End Sub
This is an idea that doesnt work.
myTnk are a list of named shapes that I want to hide or show when a data validation drop down choice is picked.
This code is attempting to hide everything.
The below works but seems clunky and I have another section that has many more entries. wanting to simplify with a loop or something else
VBA Code:
Sub Reactors()
' Hide_All Reactors Macro
With ActiveSheet.Shapes
.Range(Array("201")).Visible = False
.Range(Array("202")).Visible = False
.Range(Array("301")).Visible = False
.Range(Array("302")).Visible = False
.Range(Array("303")).Visible = False
.Range(Array("401")).Visible = False
.Range(Array("402")).Visible = False
.Range(Array("403")).Visible = False
.Range(Array("406")).Visible = False
End With
End Sub
VBA Code:
Sub Reactors2()
' Hide_Reactors Macro
With ActiveSheet.Shapes
Dim sObject As Shape
For Each sObject In ActiveSheet.Shapes
If sObject > 200 Then .Visible = False
Next
End With
End Sub
Mark