I have a spread sheet containing many macros one of which is Worksheet_SelectionChange macro. All macros work as expected but I am unable to protect t

Ernie Hatton

New Member
Joined
Jun 8, 2016
Messages
9
Hi All
I have a spread sheet containing eight macros all of which function correctly. One of the macros is a Worksheet_SelectionChange macro and when I come to protect parts of the worksheet I get an error message directing me to debug the SelectionChange macro which, in the unprotected worksheet, works perfectly. Is it possible to protect a worksheet containing this kind of macro?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Yes, but you need to unprotect the sheet at the start of the code & reprotect it again at the end.
 
Upvote 0
Yes, but you need to unprotect the sheet at the start of the code & reprotect it again at the end.
Hi Fluff- Thank you for the reply, I always do as you say but I must admit you gave me a very good clue. I did not turn off 'protect' before selecting the column to be unprotected, this resulted in the whole spreadsheet becoming protected when the column was selected giving the impression that protection was not working correctly.

I then forgot to turn protect again when the task was done, but I have learned that lesson now.

Once again many thanks, it is always the simple things that catch you out!

Regards
Ernie
 
Upvote 0
Glad you sorted it & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,216,110
Messages
6,128,894
Members
449,477
Latest member
panjongshing

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