Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: Protection property inadequate?

  1. #1
    New Member
    Join Date
    Apr 2002
    Posts
    21
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I'm writing a program for schoolkids and don't want them to alter any cells that are part of the assignment or to access VBA. The assignment involves clicking buttons that invoke macros. The macros change text in locked cells by deprotecting then reprotecting...

    ActiveSheet.Unprotect
    ActiveCell.FormulaR1C1 = "hello"
    ActiveSheet.Protect

    This is the wrong approach because of its drawbacks....
    1) if a student tries to change a locked cell, a message box appears that tells him how to deprotect it.
    2) a password option would be clumsy in a computer lab with 30 kids.
    3) if the macro doesn't deprotect first, then a message box is invoked that gives students access to VBA (which they otherwise don't know exists) via the debug button.

    Is there a way for a macro to slip a cell text change under the veil of protection without these message boxes?

    And/or can the message box that explains how to deprotect the sheet be taken out or reworded?

    Thanks in advance

  2. #2
    MrExcel MVP Mark O'Brien's Avatar
    Join Date
    Feb 2002
    Location
    Columbus, OH, USA
    Posts
    3,530
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    And/or can the message box that explains how to deprotect the sheet be taken out or reworded?

    Thanks in advance
    I'm going for "or" on this one. Yes of course you can get rid of this messagebox. Open the Excel file, hit ALT+F11 do a search for the first two words in the messagebox (CTRL+F), making sure that you're searching the whole project (one of the option buttons)


    Then delete the line that begins "msgbox".

    HTH

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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