Intersect, Target code does not work on protected sheet

mdd16

Board Regular
Joined
Jan 11, 2011
Messages
84
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have encountered a problem that has made me very disappointed at end of a huge project.

I have created intersect, target code for changing in-cell drop down lists for Data validation. I am changing contents of drop down list based on the prior cell value. It has been working like a charm on my computer. However for handing out file copies to others, I need to password protect the sheet.

When I am putting password protection on the sheet the intersect, target procedures, which I have written for the sheet stop working..

Have I reached end of the road .. or there is a way to solve this..


thanks for your attention.. Any help will be appreciated very much..
 
Following up, it looks like the code is looping because you haven't disabled events, although I'm not entirely sure why it it is behaving differently when the sheet is protected.

Making this minor edit to the code to prevent it from looping when the adjacent columns are cleared appears to work correctly, although there may be other problems that I have not found.
You will still need the lines to unprotect at the start and reprotect at the end.
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False

    ' rest of code goes here

Application.EnableEvents = True
End Sub
 
Upvote 0

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I works like charm. Can't thank you enough for saving the day for me.. You guys are like excel magicians..
Thank you ??
 
Upvote 0

Forum statistics

Threads
1,223,532
Messages
6,172,878
Members
452,486
Latest member
standw01

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