ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   change all the autoshapes (https://www.excelbanter.com/excel-programming/372239-change-all-autoshapes.html)

Max Bialystock[_2_]

change all the autoshapes
 
Hi,
I'm wondering if it's possible to change all the autoshapes in an Excel 2003
worksheet from oval to square.

If there's a way to do this using VBA it would certainly save me a lot of
time and effort.

Thanks in advance,
Max



Jim Cone

change all the autoshapes
 
Was the play a success?
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

Sub SquareUpThoseCorners()
Dim shp As Excel.Shape
For Each shp In ActiveSheet.Shapes
If shp.AutoShapeType = msoShapeOval Then
shp.AutoShapeType = msoShapeRectangle
shp.Height = shp.Width
End If
Next
End Sub
'------------



"Max Bialystock"

wrote in message
Hi,
I'm wondering if it's possible to change all the autoshapes in an Excel 2003
worksheet from oval to square.

If there's a way to do this using VBA it would certainly save me a lot of
time and effort.

Thanks in advance,
Max



Jim Cone

change all the autoshapes
 
And this should prevent errors...

Sub SquareUpThoseCorners_R1()
Dim shp As Excel.Shape
For Each shp In ActiveSheet.Shapes
If shp.Type = msoAutoShape Then
If shp.AutoShapeType = msoShapeOval Then
shp.AutoShapeType = msoShapeRectangle
shp.Height = shp.Width
End If
End If
Next
End Sub
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html


All times are GMT +1. The time now is 08:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com