Avoid deleting Drop Down shapes contained in cells validation lists

drom

Well-known Member
Joined
Mar 20, 2005
Messages
540
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and thanks in advance !

I have a CRM sheet where I am inserting some images (X images using a macro, being X dinamic)

Some times I am deleting the inserted images using a macro:


VBA Code:
Dim aImagesToKeep():      aImagesToKeep() = Array("bAAAs", "bConcep", _
                              "bPath", "bImport", "bSaveCRM", "bUpdateWKB", "bClearCRM", _
                              "bOpenInvoice", "bCRM_Group")
Dim bDelete As Boolean
  Dim YAs Single
Dim X as Byte                          
  For Each SHP In Sheets(wsCRM).Shapes
    bDelete = True:                       Y= Y+ 1
    For X = LBound(aImagesToKeep) To UBound(aImagesToKeep)
      If LCase(SHP.Name) = LCase(aImagesToKeep(X)) Then
        bDelete = False:                  Exit For
      End If
    Next X
    If bDelete Then
      Debug.Print SHP.Name, X, Y
      SHP.Delete
    End If
  Next SHP

My CRM sheet contains many cells with data validation lists, some tables with the header with arrows, somer cells with Comments, some pivot tables...

Sometimes looks like this macro deletes the "Drop Down Nº" . cells's listboxes etc...

How can avoid this ??

I would like to delete the inserted shapes,, pictures
Not the arrows etc on the cells
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,398
Latest member
rjsteward

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top