In this iteration i tied updating c4 with a worksheet_change event so that you don't have to select the turn on button . You'll still need to use the filter off to clear the autofilter. Here is the worksheet change code :
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Rng As Range
Dim last As Long
Dim sht As String
Application.EnableEvents = True
If Not Intersect(Target, Range("C4")) Is Nothing Then
'specify sheet name in which the data is stored
sht = "Commercial attribs per Brick"
'Find the LastRow in the sheet at bottom of lowest column ie count col
last = Sheets(sht).Cells(Rows.Count, "B").End(xlUp).Row
Set Rng = Sheets(sht).Range("A9:CS" & last)
'set autofilter
With Rng
.AutoFilter
.AutoFilter Field:=2, Criteria1:=Target.Value2(1, 2)
End With
End If
End Sub
Here is the filter on and off code:
Option Explicit
Sub filter()
Application.ScreenUpdating = False
Dim x As Range
Dim Rng, T As Range
Dim last As Long
Dim sht As String
'specify sheet name in which the data is stored
sht = "Commercial attribs per Brick"
'change filter column in the following code
last = Sheets(sht).Cells(Rows.Count, "B").End(xlUp).Row
Set Rng = Sheets(sht).Range("A9:CS" & last)
For Each x In Range("C4")
With Rng
.AutoFilter
.AutoFilter Field:=2, Criteria1:=x.Value
End With
Next x
With Application
.CutCopyMode = False
.ScreenUpdating = True
End With
End Sub
Sub TurnOffFilter()
Dim sht As String
'specify sheet name in which the data is stored
sht = "Commercial attribs per Brick"
' Turn off filter
Sheets(sht).AutoFilterMode = False
End Sub
Bookmarks