Macro that filters a table but then disables autofilter

pwebley

Board Regular
Joined
Mar 2, 2011
Messages
69
Right now I have a macro that filters a table based on a cell's value. It does great filtering the table but after it runs I can't filter it manually anymore. I have a feeling that it is because it protects the sheet at the end of it and doesn't leave the option of using the auto filter. Does anyone know how I can re-protect the sheet at the end of the macro but still allow me to manually auto filter the table still?

Here is the code:
PHP:
Sub Generate_Source_List()
ActiveSheet.Unprotect
 Application.ScreenUpdating = False
ActiveSheet.ListObjects("Table32").Range.AutoFilter Field:=3, Criteria1:= _
        Range("C8").Value, Operator:=xlAnd
 Application.ScreenUpdating = True
  ActiveSheet.Protect
End Sub
 

Excel Facts

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,224,541
Messages
6,179,418
Members
452,912
Latest member
alicemil

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