Hi,
I want to run a filter when one of twenty named cells are changed. Problem is I can only add two cells to the 'set cells', I need to add twenty. Also the filter runs on 800 cells, is there anyway to speed it up a little? Thanks in advance. ( I'm not an expert at VBA )
Private Sub Worksheet_Change(ByVal Target As Range)
'Sets sheet password
'sheetpassword = "password"
'Sets Sheet Name variable (registers the current month sheet name)
'Sheetname = ActiveSheet.Name
'unlock sheet
' Worksheets(Sheetname).Unprotect Password:=sheetpassword
Dim cell As Range
'Cells that cause the change.
Set cell = Range("rides", "animals")
If Not Application.Intersect(cell, Range(Target.Address)) Is Nothing Then
Application.ScreenUpdating = False
'Clear the filter in the worksheet
Worksheets("Field_BOOKING & PROFILE FORM").AutoFilterMode = False
'Select the range to be filtered
Application.Goto Reference:="Booking_form_Entire_form"
Selection.AutoFilter
ActiveSheet.Range("Booking_form_Entire_form").AutoFilter Field:=1, Criteria1:="SHOW"
Else
End If
'protect sheet
Worksheets(Sheetname).Protect Password:=sheetpassword
Application.ScreenUpdating = True
End Sub
I want to run a filter when one of twenty named cells are changed. Problem is I can only add two cells to the 'set cells', I need to add twenty. Also the filter runs on 800 cells, is there anyway to speed it up a little? Thanks in advance. ( I'm not an expert at VBA )
Private Sub Worksheet_Change(ByVal Target As Range)
'Sets sheet password
'sheetpassword = "password"
'Sets Sheet Name variable (registers the current month sheet name)
'Sheetname = ActiveSheet.Name
'unlock sheet
' Worksheets(Sheetname).Unprotect Password:=sheetpassword
Dim cell As Range
'Cells that cause the change.
Set cell = Range("rides", "animals")
If Not Application.Intersect(cell, Range(Target.Address)) Is Nothing Then
Application.ScreenUpdating = False
'Clear the filter in the worksheet
Worksheets("Field_BOOKING & PROFILE FORM").AutoFilterMode = False
'Select the range to be filtered
Application.Goto Reference:="Booking_form_Entire_form"
Selection.AutoFilter
ActiveSheet.Range("Booking_form_Entire_form").AutoFilter Field:=1, Criteria1:="SHOW"
Else
End If
'protect sheet
Worksheets(Sheetname).Protect Password:=sheetpassword
Application.ScreenUpdating = True
End Sub