ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   Macro to delete any control box and pictures (https://www.excelbanter.com/excel-worksheet-functions/255843-macro-delete-any-control-box-pictures.html)

Steve

Macro to delete any control box and pictures
 
I recorded this macro:

ActiveSheet.Shapes("Control 3").Select
Selection.Cut
ActiveSheet.Shapes("Picture 1").Select
Selection.Cut
ActiveSheet.Shapes("Picture 2").Select
Selection.Cut

but it hang's (item with the spcified name wasn't found)

I assume by downloading various data, the numbers of the objects change, and
that's probably why it's hanging. Different data but all with the same
control box and pictures.
Is there a way to run a macro that will delete the control box and pictures.
Perhaps writing it as :
Cut any control, any picture, any button ?

Thanks,

Steve



Gord Dibben

Macro to delete any control box and pictures
 
Have you tried F5SpecialObjectsOK

EditClearAll

May be too destructive if you have other objects you want to keep.


Gord Dibben MS Excel MVP


On Tue, 9 Feb 2010 12:10:01 -0800, Steve
wrote:

I recorded this macro:

ActiveSheet.Shapes("Control 3").Select
Selection.Cut
ActiveSheet.Shapes("Picture 1").Select
Selection.Cut
ActiveSheet.Shapes("Picture 2").Select
Selection.Cut

but it hang's (item with the spcified name wasn't found)

I assume by downloading various data, the numbers of the objects change, and
that's probably why it's hanging. Different data but all with the same
control box and pictures.
Is there a way to run a macro that will delete the control box and pictures.
Perhaps writing it as :
Cut any control, any picture, any button ?

Thanks,

Steve



Steve

Macro to delete any control box and pictures
 
Thank you, but like you said, it's a bit too destructive, as I have a macro
button that it also gets cut.
Any thoughts on how to cut all but the macro button ?



"Gord Dibben" wrote:

Have you tried F5SpecialObjectsOK

EditClearAll

May be too destructive if you have other objects you want to keep.


Gord Dibben MS Excel MVP


On Tue, 9 Feb 2010 12:10:01 -0800, Steve
wrote:

I recorded this macro:

ActiveSheet.Shapes("Control 3").Select
Selection.Cut
ActiveSheet.Shapes("Picture 1").Select
Selection.Cut
ActiveSheet.Shapes("Picture 2").Select
Selection.Cut

but it hang's (item with the spcified name wasn't found)

I assume by downloading various data, the numbers of the objects change, and
that's probably why it's hanging. Different data but all with the same
control box and pictures.
Is there a way to run a macro that will delete the control box and pictures.
Perhaps writing it as :
Cut any control, any picture, any button ?

Thanks,

Steve


.



All times are GMT +1. The time now is 11:57 PM.

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