This code seams to work fine when run manually but I want it to run when the drop down list in cell "A1" is changed. All I want to do is keep the sheet protected and only allow the user to change cell "A1". I want the code/Macro to hide all blank cells in column "AC". I don't know enough about what I am doing to do this. Can someone show me what I am doing wrong? Also if it is not too much trouble I would like for columns "W", "X", "Y", "Z", "AA" hiden unless row 2 in each of these columns (W-AA)matches cell "A1".
Can someone please help me with this?
Thanks a million
Keithb
Private Sub Worksheet_Change(ByVal Target As Range)
Cancel = True
Sheets("By_Salesman").Unprotect "jonna1"
Set t = Target
Set A1 = Range("A1")
If Intersect(t, A1) Is Nothing Then Exit Sub
Application.EnableEvents = False
Call Macro3
Application.EnableEvents = True
Sheets("By_Salesman").Protect "jonna1"
End Sub
Sub Macro3()
'
' Macro3 Macro
' Filter
'
ActiveSheet.Range("$A$2:$W$54").AutoFilter Field:=23, Criteria1:="<>"
End Sub
Can someone please help me with this?
Thanks a million
Keithb
Private Sub Worksheet_Change(ByVal Target As Range)
Cancel = True
Sheets("By_Salesman").Unprotect "jonna1"
Set t = Target
Set A1 = Range("A1")
If Intersect(t, A1) Is Nothing Then Exit Sub
Application.EnableEvents = False
Call Macro3
Application.EnableEvents = True
Sheets("By_Salesman").Protect "jonna1"
End Sub
Sub Macro3()
'
' Macro3 Macro
' Filter
'
ActiveSheet.Range("$A$2:$W$54").AutoFilter Field:=23, Criteria1:="<>"
End Sub