PDA

View Full Version : [SOLVED:] calling selected shape help



rosalie
10-26-2017, 06:34 AM
Hi everyone,

I've assigned a macro to a shape and have an if statement in that macro that calls the shape I've clicked on. I've tried different combinations I've trying to call this shape but can't seem to do it:


Sub subShapeMacro()


Dim shp As Shape


If IsShiftKeyDown Then
If ActiveSheet.Selection.ShapeRange(1).ZOrderPosition = 0 Then
subHideShapes
ElseIf ActiveSheet.Selection.ShapeRange(1).ZOrderPosition = 0 Then
subShowShapes
End If
Else
subSiteClick
End If


End Sub

I've tried taking Activesheet out, not using (1)

Btw the zorderposition is set to 0 just for testing purposes as I'm not sure what I need to set it to

Thanks in advance!

Jan Karel Pieterse
10-27-2017, 02:46 AM
This gets you the shape that was clicked on:

Dim oShp As Shape
Set oShp = ActiveSheet.Shapes(Application.Caller)