ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Removing objects without unmerging cells (https://www.excelbanter.com/excel-programming/299553-removing-objects-without-unmerging-cells.html)

No Name

Removing objects without unmerging cells
 
When I use this code on a worksheet that doesn't contain
clip art to delete, I get the error message "This
operation will cause some merged cells to unmerge. Do you
want to continue". How can I use this code to delete
unwanted clip art objects without unmerging any cells?

Set myDocument = Worksheets(1)
myDocument.Shapes.SelectAll
Selection.Delete

JE McGimpsey

Removing objects without unmerging cells
 
one way:

Dim myDocument As Worksheet
Set myDocument = Worksheets(1)
With myDocument.Pictures
If .Count 0 Then .Delete
End With


In article ,
wrote:

When I use this code on a worksheet that doesn't contain
clip art to delete, I get the error message "This
operation will cause some merged cells to unmerge. Do you
want to continue". How can I use this code to delete
unwanted clip art objects without unmerging any cells?

Set myDocument = Worksheets(1)
myDocument.Shapes.SelectAll
Selection.Delete


No Name

Removing objects without unmerging cells
 
Thanks!...Works good!

-----Original Message-----
one way:

Dim myDocument As Worksheet
Set myDocument = Worksheets(1)
With myDocument.Pictures
If .Count 0 Then .Delete
End With


In article ,
wrote:

When I use this code on a worksheet that doesn't

contain
clip art to delete, I get the error message "This
operation will cause some merged cells to unmerge. Do

you
want to continue". How can I use this code to delete
unwanted clip art objects without unmerging any cells?

Set myDocument = Worksheets(1)
myDocument.Shapes.SelectAll
Selection.Delete

.



All times are GMT +1. The time now is 08:49 AM.

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