VBA to Select all Shapes on the sheet

1stNoobie

Board Regular
Joined
Jul 15, 2009
Messages
69
This there a way to change the below code to select all Diagrams on the active sheet?

ActiveSheet.Shapes.Range(Array("Diagram 452")).Select
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
This there a way to change the below code to select all Diagrams on the active sheet?

ActiveSheet.Shapes.Range(Array("Diagram 452")).Select
If the only shapes on the active sheet are diagrams, then you can select them all with this single line of code...
Code:
Sub SelectAllShapesOnTheActiveSheet()
  ActiveSheet.Shapes.SelectAll
End Sub
However, if there could be other shapes on the worksheet along with the diagrams, then you could use this code to select all the diagrams only...
Code:
Sub SelectAllDiagramsOnActiveSheet()
  Dim Dia As Diagram, Sh As Shape
  For Each Sh In ActiveSheet.Shapes
    If Sh.Type = msoDiagram Then Sh.Select False
  Next
End Sub
 
Upvote 0
Don't worry - Rick has provided a detailed solution
 
Upvote 0
I have a workbook that has several rounded rectangle shapes on it that I want to be able to mouse click and change the color between no fill red or green. I can perform on any cell on the sheet using the following code but cant get it to work for shapes. can you help?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Select Case Target.Interior.ColorIndex
Case xlNone, 4: Target.Interior.ColorIndex = 3
Case Else: Target.Interior.ColorIndex = 4
End Select
End Sub
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Target.Interior.ColorIndex = xlNone
End Sub
 
Upvote 0

Forum statistics

Threads
1,221,494
Messages
6,160,141
Members
451,624
Latest member
TheWes

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