+ Reply to Thread
Results 1 to 5 of 5

VBA Display message when sheet protected

  1. #1
    Registered User
    Join Date
    05-28-2009
    Location
    Birmingham
    MS-Off Ver
    Excel 2003
    Posts
    3

    VBA Display message when sheet protected

    Hi.

    Hoping someone can help as this is driving me crazy as im still pretty much a beginner when it comes to vba!

    I have a sheet which is protected other than a copy of cells which may be edited. I want to display a message box when the user clicks elsewhere on the sheet. I have the message box in a macro, and i have the sheet protected - but can not seem to join the two together so the box displays automatically.

    Can anyone help?! Thank you!

  2. #2
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: VBA Display message when sheet protected

    Hi there,

    Try entering the following code in the VBA module of the worksheet for which you want the warning message to be generated (right-click on the worksheet tab, and select View Code)

    Please Login or Register  to view this content.
    selection (see note below)

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M


    NOTE TO FORUM ADMINISTRATORS

    When I enter the word "selection" without highlighting the "t" in the above code, the screen displays the "The website cannot display this page" error. It took me quite a while to figure out exactly which part of my post was causing the error!

    Any comments?

    Greg M

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: VBA Display message when sheet protected

    Greg, the forum is continuing to have problems since the switch to the new server. I don't have an ETA.

    nic, why not just disallow selection of locked cells when you protect the sheet?
    Entia non sunt multiplicanda sine necessitate

  4. #4
    Registered User
    Join Date
    05-28-2009
    Location
    Birmingham
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: VBA Display message when sheet protected

    This is great Greg - thank you! Works perfectly - exactly what i was looking for!

  5. #5
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,641

    Re: VBA Display message when sheet protected

    Hi Nic,

    Many thanks for your feedback - I'm glad I was able to help.

    Regards,

    Greg M


    SHG - many thanks for your prompt reply to my question.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1