Consulting

Results 1 to 3 of 3

Thread: Turning off alerts issue

  1. #1
    VBAX Contributor
    Joined
    Jul 2017
    Location
    Zurich
    Posts
    132
    Location

    Turning off alerts issue

    Hi Folks

    I'm tring to let the user select rows within a table and to give a feedback via cell color change. However, this is to happen on a locked worksheet.

    Therefore, I've added an event procedure (double click) that unlocks the worksheet at the top of the procedure and lock it again before exiting the procedure.

    This is all working as expected, but when the locking statement is carried out, a message box pops up, saying that my sheet is protected and blabla. But, actually, at that point the procedure did it's job; so it's only the annoying message I'd like to get rid off. I've tried "Application.DisplayAlerts = False", but that has no effect.

    Any ideas?

    Cheers

  2. #2
    VBAX Mentor
    Joined
    Dec 2008
    Posts
    404
    Location
    Double clicking on a cell will edit it. If the sheet is protected, you get information about it and the cell will not be edited. So much theory. Now let's get to practice.
    You've definitely used the Worksheet_BeforeDoubleClick event. As the name suggests, this event occurs immediately after double-clicking, but before editing the cell. In this state, you unlocked the sheet, changed something in it, and re-locked it. After completing the procedure, an attempt is made to edit this cell (I remind you of the first and second sentences of my speech).
    If you want the double-click to work non-standard, you must disable standard operation. In a very simple way. In the mentioned event, at the end of the procedure add
     Cancel = True
    You can put this line of code almost anywhere in the procedure.

    Artik

  3. #3
    VBAX Contributor
    Joined
    Jul 2017
    Location
    Zurich
    Posts
    132
    Location
    Thank you very much Artik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •