+ Reply to Thread
Results 1 to 3 of 3

avoiding run time error by using a message box of some sort

  1. #1
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    avoiding run time error by using a message box of some sort

    hello,

    I have a button on one of my worksheets, and I don't want it to be used if the sheet is protected.

    Currently, if you click the button, and the sheet is protected, then it outputs "Run time error 1004: cannot use this command when the sheet is protected" (or something of that sort).

    How can I catch this error, so that instead of this error coming up, a message box comes up informing the user to first unprotect the sheet?

    Please Help

  2. #2
    Forum Expert JasperD's Avatar
    Join Date
    05-07-2013
    Location
    Netherlands
    MS-Off Ver
    Excel 2016
    Posts
    1,393

    Re: avoiding run time error by using a message box of some sort

    The button calls a macro, I suppose.
    At the first line of the macro, put :

    Please Login or Register  to view this content.
    Please click the * below if this helps

  3. #3
    Forum Contributor
    Join Date
    05-20-2013
    Location
    Ann Arbor, MI
    MS-Off Ver
    Excel 2010
    Posts
    255

    Re: avoiding run time error by using a message box of some sort

    Thanks JasperD,

    it works perfectly!

+ 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