Protect/Unprotect on cell change and run macro

keithb

New Member
Joined
Oct 29, 2008
Messages
42
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
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.

Forum statistics

Threads
1,224,599
Messages
6,179,831
Members
452,946
Latest member
JoseDavid

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