View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
rdwj rdwj is offline
external usenet poster
 
Posts: 95
Default VB to clear any filters when closing a spreadsheet

how about worksheet.protection = false
then remove your filter, and turn the protection back on.

Having said that, if you manage to turn the filter on with the applied
protection, the protection should not stop you removing it......




"Kevin" wrote:

Hi

I want to enter some vb to a Workbook_BeforeClose option that automatically
clears any filters in a specific sheet as the workbook is closed. Example of
recorded code is below which works but I have the sheet protected so I do not
believe below code is optimal for a protected sheet. Is there simple code to
simply clear any filters?

Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter
--
Kevin