BeforeDoubleClick on Protected Cell












1















I wrote some code that manipulates the target cell when it is double-clicked by the user. The code works fine for most cells on the worksheet.



But the worksheet is protected (only unlocked cells are accessible), and if the user happens to double-click on one of the locked cells, the code executes as if that cell (that happened to be selected at the time of the double-click occurred) was the one double-clicked.



Can anyone think of a way to recognize that the double-click occurs on a locked cell? Thank you.










share|improve this question

























  • I've tried to replicate your issue but couldn't succeed. If I enable to select locked cells, then it just works correctly and BeforeDoubleClick shows the correct information. If I don't enable selection of locked cells, only unlocked than Excel doesn't work correctly and I just can't select anything, that's probably not related to VBA. I'm using Excel 2013. Maybe you could share more details how exactly you experience the issue.

    – Máté Juhász
    Jan 15 at 7:47











  • I think Maté misunderstands the issue. I can simulate it. The fact is that if you double click outside of the cells that can be selected, the macro runs for the cell that is still selected within the unlocked range. I haven't found a solution though ;-)

    – Joost
    Jan 17 at 21:34













  • I did some more testing but still to no avail :-( I added MsgBox Target.Address in the doubleClick event to know where it is triggered from, and then disabled selection by .EnableSelection = xlNoSelection, but that would still give me just the unlocked cells when I clicked on a locked cell. I tried the other events but they all are not triggered when clicking the locked part. So, sorry!

    – Joost
    Jan 22 at 15:58


















1















I wrote some code that manipulates the target cell when it is double-clicked by the user. The code works fine for most cells on the worksheet.



But the worksheet is protected (only unlocked cells are accessible), and if the user happens to double-click on one of the locked cells, the code executes as if that cell (that happened to be selected at the time of the double-click occurred) was the one double-clicked.



Can anyone think of a way to recognize that the double-click occurs on a locked cell? Thank you.










share|improve this question

























  • I've tried to replicate your issue but couldn't succeed. If I enable to select locked cells, then it just works correctly and BeforeDoubleClick shows the correct information. If I don't enable selection of locked cells, only unlocked than Excel doesn't work correctly and I just can't select anything, that's probably not related to VBA. I'm using Excel 2013. Maybe you could share more details how exactly you experience the issue.

    – Máté Juhász
    Jan 15 at 7:47











  • I think Maté misunderstands the issue. I can simulate it. The fact is that if you double click outside of the cells that can be selected, the macro runs for the cell that is still selected within the unlocked range. I haven't found a solution though ;-)

    – Joost
    Jan 17 at 21:34













  • I did some more testing but still to no avail :-( I added MsgBox Target.Address in the doubleClick event to know where it is triggered from, and then disabled selection by .EnableSelection = xlNoSelection, but that would still give me just the unlocked cells when I clicked on a locked cell. I tried the other events but they all are not triggered when clicking the locked part. So, sorry!

    – Joost
    Jan 22 at 15:58
















1












1








1








I wrote some code that manipulates the target cell when it is double-clicked by the user. The code works fine for most cells on the worksheet.



But the worksheet is protected (only unlocked cells are accessible), and if the user happens to double-click on one of the locked cells, the code executes as if that cell (that happened to be selected at the time of the double-click occurred) was the one double-clicked.



Can anyone think of a way to recognize that the double-click occurs on a locked cell? Thank you.










share|improve this question
















I wrote some code that manipulates the target cell when it is double-clicked by the user. The code works fine for most cells on the worksheet.



But the worksheet is protected (only unlocked cells are accessible), and if the user happens to double-click on one of the locked cells, the code executes as if that cell (that happened to be selected at the time of the double-click occurred) was the one double-clicked.



Can anyone think of a way to recognize that the double-click occurs on a locked cell? Thank you.







microsoft-excel vba






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 15 at 7:48









Máté Juhász

14.3k63351




14.3k63351










asked Jan 15 at 7:01









billyk34billyk34

61




61













  • I've tried to replicate your issue but couldn't succeed. If I enable to select locked cells, then it just works correctly and BeforeDoubleClick shows the correct information. If I don't enable selection of locked cells, only unlocked than Excel doesn't work correctly and I just can't select anything, that's probably not related to VBA. I'm using Excel 2013. Maybe you could share more details how exactly you experience the issue.

    – Máté Juhász
    Jan 15 at 7:47











  • I think Maté misunderstands the issue. I can simulate it. The fact is that if you double click outside of the cells that can be selected, the macro runs for the cell that is still selected within the unlocked range. I haven't found a solution though ;-)

    – Joost
    Jan 17 at 21:34













  • I did some more testing but still to no avail :-( I added MsgBox Target.Address in the doubleClick event to know where it is triggered from, and then disabled selection by .EnableSelection = xlNoSelection, but that would still give me just the unlocked cells when I clicked on a locked cell. I tried the other events but they all are not triggered when clicking the locked part. So, sorry!

    – Joost
    Jan 22 at 15:58





















  • I've tried to replicate your issue but couldn't succeed. If I enable to select locked cells, then it just works correctly and BeforeDoubleClick shows the correct information. If I don't enable selection of locked cells, only unlocked than Excel doesn't work correctly and I just can't select anything, that's probably not related to VBA. I'm using Excel 2013. Maybe you could share more details how exactly you experience the issue.

    – Máté Juhász
    Jan 15 at 7:47











  • I think Maté misunderstands the issue. I can simulate it. The fact is that if you double click outside of the cells that can be selected, the macro runs for the cell that is still selected within the unlocked range. I haven't found a solution though ;-)

    – Joost
    Jan 17 at 21:34













  • I did some more testing but still to no avail :-( I added MsgBox Target.Address in the doubleClick event to know where it is triggered from, and then disabled selection by .EnableSelection = xlNoSelection, but that would still give me just the unlocked cells when I clicked on a locked cell. I tried the other events but they all are not triggered when clicking the locked part. So, sorry!

    – Joost
    Jan 22 at 15:58



















I've tried to replicate your issue but couldn't succeed. If I enable to select locked cells, then it just works correctly and BeforeDoubleClick shows the correct information. If I don't enable selection of locked cells, only unlocked than Excel doesn't work correctly and I just can't select anything, that's probably not related to VBA. I'm using Excel 2013. Maybe you could share more details how exactly you experience the issue.

– Máté Juhász
Jan 15 at 7:47





I've tried to replicate your issue but couldn't succeed. If I enable to select locked cells, then it just works correctly and BeforeDoubleClick shows the correct information. If I don't enable selection of locked cells, only unlocked than Excel doesn't work correctly and I just can't select anything, that's probably not related to VBA. I'm using Excel 2013. Maybe you could share more details how exactly you experience the issue.

– Máté Juhász
Jan 15 at 7:47













I think Maté misunderstands the issue. I can simulate it. The fact is that if you double click outside of the cells that can be selected, the macro runs for the cell that is still selected within the unlocked range. I haven't found a solution though ;-)

– Joost
Jan 17 at 21:34







I think Maté misunderstands the issue. I can simulate it. The fact is that if you double click outside of the cells that can be selected, the macro runs for the cell that is still selected within the unlocked range. I haven't found a solution though ;-)

– Joost
Jan 17 at 21:34















I did some more testing but still to no avail :-( I added MsgBox Target.Address in the doubleClick event to know where it is triggered from, and then disabled selection by .EnableSelection = xlNoSelection, but that would still give me just the unlocked cells when I clicked on a locked cell. I tried the other events but they all are not triggered when clicking the locked part. So, sorry!

– Joost
Jan 22 at 15:58







I did some more testing but still to no avail :-( I added MsgBox Target.Address in the doubleClick event to know where it is triggered from, and then disabled selection by .EnableSelection = xlNoSelection, but that would still give me just the unlocked cells when I clicked on a locked cell. I tried the other events but they all are not triggered when clicking the locked part. So, sorry!

– Joost
Jan 22 at 15:58












0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394395%2fbeforedoubleclick-on-protected-cell%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1394395%2fbeforedoubleclick-on-protected-cell%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to make a Squid Proxy server?

第一次世界大戦

Touch on Surface Book