Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Deleting shapes

Is there a macro I can run to delete shapes from
spreadsheet? I am pasting contents from another source
into the current project. I have recorded a macro to go
through and delete all the shapes. But it does not work.
The title of the shapes change with every paste. so the
macro can't find that specific shape. Can anyone help?

Thanks for your time,
Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Deleting shapes

for each shp in Activesheet.Shapes
shp.Delete
Next

or

Activesheet.Shapes.SelectAll
Selection.Delete


--
Regards,
Tom Ogilvy


"Steve" wrote in message
...
Is there a macro I can run to delete shapes from
spreadsheet? I am pasting contents from another source
into the current project. I have recorded a macro to go
through and delete all the shapes. But it does not work.
The title of the shapes change with every paste. so the
macro can't find that specific shape. Can anyone help?

Thanks for your time,
Steve



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Deleting shapes

Any of these should work. I use the first one.

Sub ShapesCut()
For Each S In ActiveSheet.Shapes
S.Cut
Next
End Sub
'or
Sub shapescut1() 'Tom Ogilvy
ActiveSheet.Shapes.SelectAll
Selection.Delete
End Sub
Sub ShapesALLinWorkbookDelete() 'Deletes all in WORKBOOK
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
sh.DrawingObjects.Delete
Next sh
End Sub
Sub ShapesInRangeDelete() 'Iain
Dim shpLoop As Shape
Set rngUsable = Range("e1:e24")
For Each shpLoop In ActiveSheet.Shapes
'does the top left corner of the shape overlap rngUsable?
If Not (Application.Intersect(rngUsable, shpLoop.TopLeftCell) Is Nothing)
Then
shpLoop.Delete
End If
Next shpLoop
End Sub
Sub RemoveObjectsFromSelection() 'Jake Marx MVP
Dim ole As OLEObject
Dim shp As Shape

For Each ole In Selection.Parent.OLEObjects
If Not Application.Intersect(Selection, _
ole.TopLeftCell) Is Nothing Then
ole.Delete
End If
Next ole

For Each shp In Selection.Parent.Shapes
If Not Application.Intersect(Selection, _
shp.TopLeftCell) Is Nothing Then
shp.Delete
End If
Next shp
End Sub

--
Don Guillett
SalesAid Software

"Steve" wrote in message
...
Is there a macro I can run to delete shapes from
spreadsheet? I am pasting contents from another source
into the current project. I have recorded a macro to go
through and delete all the shapes. But it does not work.
The title of the shapes change with every paste. so the
macro can't find that specific shape. Can anyone help?

Thanks for your time,
Steve



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default Deleting shapes

1st one worked great. thanks for the help.

Steve
-----Original Message-----
Any of these should work. I use the first one.

Sub ShapesCut()
For Each S In ActiveSheet.Shapes
S.Cut
Next
End Sub
'or
Sub shapescut1() 'Tom Ogilvy
ActiveSheet.Shapes.SelectAll
Selection.Delete
End Sub
Sub ShapesALLinWorkbookDelete() 'Deletes all in WORKBOOK
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
sh.DrawingObjects.Delete
Next sh
End Sub
Sub ShapesInRangeDelete() 'Iain
Dim shpLoop As Shape
Set rngUsable = Range("e1:e24")
For Each shpLoop In ActiveSheet.Shapes
'does the top left corner of the shape overlap

rngUsable?
If Not (Application.Intersect(rngUsable,

shpLoop.TopLeftCell) Is Nothing)
Then
shpLoop.Delete
End If
Next shpLoop
End Sub
Sub RemoveObjectsFromSelection() 'Jake Marx MVP
Dim ole As OLEObject
Dim shp As Shape

For Each ole In Selection.Parent.OLEObjects
If Not Application.Intersect(Selection, _
ole.TopLeftCell) Is Nothing Then
ole.Delete
End If
Next ole

For Each shp In Selection.Parent.Shapes
If Not Application.Intersect(Selection, _
shp.TopLeftCell) Is Nothing Then
shp.Delete
End If
Next shp
End Sub

--
Don Guillett
SalesAid Software

"Steve" wrote in

message
...
Is there a macro I can run to delete shapes from
spreadsheet? I am pasting contents from another source
into the current project. I have recorded a macro to go
through and delete all the shapes. But it does not work.
The title of the shapes change with every paste. so the
macro can't find that specific shape. Can anyone help?

Thanks for your time,
Steve



.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Deleting shapes

glad to help

--
Don Guillett
SalesAid Software

"Steve" wrote in message
...
1st one worked great. thanks for the help.

Steve
-----Original Message-----
Any of these should work. I use the first one.

Sub ShapesCut()
For Each S In ActiveSheet.Shapes
S.Cut
Next
End Sub
'or
Sub shapescut1() 'Tom Ogilvy
ActiveSheet.Shapes.SelectAll
Selection.Delete
End Sub
Sub ShapesALLinWorkbookDelete() 'Deletes all in WORKBOOK
Dim sh As Worksheet
For Each sh In ActiveWorkbook.Worksheets
sh.DrawingObjects.Delete
Next sh
End Sub
Sub ShapesInRangeDelete() 'Iain
Dim shpLoop As Shape
Set rngUsable = Range("e1:e24")
For Each shpLoop In ActiveSheet.Shapes
'does the top left corner of the shape overlap

rngUsable?
If Not (Application.Intersect(rngUsable,

shpLoop.TopLeftCell) Is Nothing)
Then
shpLoop.Delete
End If
Next shpLoop
End Sub
Sub RemoveObjectsFromSelection() 'Jake Marx MVP
Dim ole As OLEObject
Dim shp As Shape

For Each ole In Selection.Parent.OLEObjects
If Not Application.Intersect(Selection, _
ole.TopLeftCell) Is Nothing Then
ole.Delete
End If
Next ole

For Each shp In Selection.Parent.Shapes
If Not Application.Intersect(Selection, _
shp.TopLeftCell) Is Nothing Then
shp.Delete
End If
Next shp
End Sub

--
Don Guillett
SalesAid Software

"Steve" wrote in

message
...
Is there a macro I can run to delete shapes from
spreadsheet? I am pasting contents from another source
into the current project. I have recorded a macro to go
through and delete all the shapes. But it does not work.
The title of the shapes change with every paste. so the
macro can't find that specific shape. Can anyone help?

Thanks for your time,
Steve



.





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
excel document with shapes on it but the shapes do not print [email protected] Excel Worksheet Functions 2 October 22nd 09 06:17 PM
Naming Auto Shapes and Creating new Shapes AL2000 Excel Discussion (Misc queries) 3 September 10th 07 04:12 AM
When drawing shapes in excel the shapes keep disappearing Tape Excel Discussion (Misc queries) 1 October 6th 06 04:23 PM
Deleting Shapes aftamath Excel Discussion (Misc queries) 5 November 5th 05 12:37 AM
Deleting shapes crashes for me. (Excel 97 vba) Excel Question Excel Programming 0 October 23rd 03 02:30 AM


All times are GMT +1. The time now is 11:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"