Macro to Run if Sheet is Unprotected

tom_blamire

Board Regular
Joined
Dec 13, 2012
Messages
99
Hi,

I need to know if it is possible for a macro to run if a specific worksheet is unprotected?
For example, if someone takes off the protection to my costings sheet either through VBA or finding out the password, i want Excel to run a certain macro if possible?


Thanks in advance

Tom
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Hi there,

Might be an easier way, but if you put this in the code for each sheet it should work.

Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)


If ActiveSheet.ProtectContents = False Then MsgBox ("Worksheet Unprotected")


End Sub


Regards
Chris
 
Upvote 0
Hahaha if I ever go to London I'm going to hold you to that.

Glad I could help.

Regards
Chris
 
Upvote 0

Forum statistics

Threads
1,216,143
Messages
6,129,110
Members
449,486
Latest member
malcolmlyle

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