ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   VBA overflow (https://www.excelbanter.com/excel-programming/275869-re-vba-overflow.html)

Don Guillett[_4_]

VBA overflow
 
does this help?

Sub ShapesCut()
For Each s In ActiveSheet.Shapes
s.Cut
Next
End Sub

"Christof" wrote in
message ...
Chaps,

I have a macro which calls a function to delete all
shapes on a worksheet.
If that sheet holds many shapes (100+), then the code
crashes while deleting the shapes: (memory at ... could
not be read)

I've tried many implementations to delete these shapes
(deleteAll, for each, ...) but I always end up in the
same situation

Can somebody give me the best way to avoid this problem?

thanks




Christof[_2_]

VBA overflow
 
Thanks a lot: yes it helps

I won't even try to understand why this does work and
exactly the same with s.delete doesn't, but it's surely
bizar.

Christof


-----Original Message-----
does this help?

Sub ShapesCut()
For Each s In ActiveSheet.Shapes
s.Cut
Next
End Sub

"Christof"

wrote in
message ...
Chaps,

I have a macro which calls a function to delete all
shapes on a worksheet.
If that sheet holds many shapes (100+), then the code
crashes while deleting the shapes: (memory at ... could
not be read)

I've tried many implementations to delete these shapes
(deleteAll, for each, ...) but I always end up in the
same situation

Can somebody give me the best way to avoid this

problem?

thanks



.


Don Guillett[_4_]

VBA overflow
 
right click a shape and see if "delete" is a choice

"Christof" <me@me wrote in message
...
Thanks a lot: yes it helps

I won't even try to understand why this does work and
exactly the same with s.delete doesn't, but it's surely
bizar.

Christof


-----Original Message-----
does this help?

Sub ShapesCut()
For Each s In ActiveSheet.Shapes
s.Cut
Next
End Sub

"Christof"

wrote in
message ...
Chaps,

I have a macro which calls a function to delete all
shapes on a worksheet.
If that sheet holds many shapes (100+), then the code
crashes while deleting the shapes: (memory at ... could
not be read)

I've tried many implementations to delete these shapes
(deleteAll, for each, ...) but I always end up in the
same situation

Can somebody give me the best way to avoid this

problem?

thanks



.





All times are GMT +1. The time now is 04:37 AM.

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