to remove unwanted buttons in a row

RSEKAR

Board Regular
Joined
Oct 18, 2010
Messages
172
Dear Sir,
I use macro in a excel sheet. I use AutoFilter in the macro for filtering under some criteria.
After sometime I find in the row where the AutoFilter took place, some of the cells contain the Buttons with the arrow down (used in AutoFilter).
Now in the menu bar Data – Filter – AutoFilter is not selected. So I am unable to remove the buttons.
The macro is completed and the macro functions are not affected when used again.
Few buttons in the row will remain permanently.
I do not know how to prevent the buttons remaining back in some of the cells (in the row in which the AutoFilter took place).
I use Excel 2002 and OS Windows XP
I use the following macro to remove all the buttons in a sheet.
This macro removes the buttons which are essential for me.
So I request you to modify the macro to remove the buttons only from the area selected.
Thanking you,
Yours truly,
Dr.R.Gnanasekaran.
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p> </o:p>
Dim GetShape As Shape<o:p></o:p>
<o:p> </o:p>
For Each GetShape In ActiveSheet.Shapes<o:p></o:p>
GetShape.DELETE<o:p></o:p>
Next<o:p></o:p>
<o:p> </o:p>
End Sub<o:p></o:p>
<o:p> </o:p>
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
This code will delete all objects from the selected range.
Code:
Sub DeleteObjectFromSelection()
Dim isect As Range
    For Each PicObj In ActiveSheet.Shapes
        TheLeft = PicObj.TopLeftCell.Address
        Set isect = Application.Intersect(Range(TheLeft), Selection)
        If Not isect Is Nothing Then PicObj.Delete
    Next PicObj
End Sub
 
Upvote 0
Dear Sir,
Thank you for your immediate action.
I selected the cells where the buttons are found and your macro has been made to run.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
I get the following error message.<o:p></o:p>
<o:p> </o:p>
Run time error ‘1004’<o:p></o:p>
Application-defind or Object-defind Error<o:p></o:p>
<o:p> </o:p>
When I click ‘Debug”, the following line in the macro has been selected.<o:p></o:p>
TheLeft = PicObj.TopLeftCell.Address<o:p></o:p>
<o:p> </o:p>
 
Upvote 0
I can not troubleshoot your issue as I can not get an AutoFilter to leave behind the "Dropdown Buttons".
Both your code and my posted code works fine in my test sheet with regular button objects. It does not remove regular AutoFilter buttons.

Please post your entire code. I can not repeat the error you are getting.
 
Upvote 0

Forum statistics

Threads
1,224,591
Messages
6,179,766
Members
452,940
Latest member
rootytrip

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