How to stop CommandButtons being deleted as pictures in code??

  • Thread starter Thread starter Corey
  • Start date Start date
C

Corey

ActiveSheet.Pictures.Delete

I need to modify the above so that it does not include all the commandbuttons, but how?
I need commandbuttons and not a forms - button as the code needs to be exportable to other files and to take the code with them.

Any ideas?
Corey....
 
Hi Corey,

Try:

'=============>>
Public Sub Tester()
Dim SHP As Shape

For Each SHP In ActiveSheet.Shapes
With SHP
If .Type = msoPicture Then
.Delete
End If
End With
Next SHP
End Sub
'<<=============



---
Regards,
Norman



ActiveSheet.Pictures.Delete

I need to modify the above so that it does not include all the
commandbuttons, but how?
I need commandbuttons and not a forms - button as the code needs to be
exportable to other files and to take the code with them.

Any ideas?
Corey....
 
Dim SHP As Shape

For Each SHP In ActiveSheet.Shapes <======== How can i change this to
ALL Sheets in workbook ?
With SHP
If .Type = msoPicture Then
.Delete
End If
End With
Next SHP

Corey....
 
Hi Corey,

Try:

'=============>>
Public Sub Tester()
Dim SH As Worksheet
Dim SHP As Shape

For Each SH In ThisWorkbook.Worksheets
For Each SHP In SH.Shapes
With SHP
If .Type = msoPicture Then
.Delete
End If
End With
Next SHP
Next SH
End Sub
'<<=============
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top