+ Reply to Thread
Results 1 to 7 of 7

Run macros in protected sheets

  1. #1
    Registered User
    Join Date
    11-25-2010
    Location
    Stockholm, sweden
    MS-Off Ver
    Excel 2007
    Posts
    15

    Run macros in protected sheets

    I want to protect all sheets in my workbook except for a few cells. When I do this I still want to be able to run my macros.

    How do I do this?
    Last edited by scara; 01-27-2011 at 12:15 PM.

  2. #2
    Registered User
    Join Date
    02-09-2010
    Location
    brussels
    MS-Off Ver
    Excel 2003
    Posts
    63

    Re: Run macros in protected sheets

    Hello scara,

    Put this code in "This Workbook" using VB

    Please Login or Register  to view this content.

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Run macros in protected sheets

    You can either add a line to the start of the code to unprotect the sheets, then restore protection at the end, or use ProtectWithUserInterface
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Registered User
    Join Date
    11-25-2010
    Location
    Stockholm, sweden
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Run macros in protected sheets

    follow up question. How do I write this code if I only want shhe3 shhet to be protected?

  5. #5
    Forum Expert Domski's Avatar
    Join Date
    12-14-2009
    Location
    A galaxy far, far away
    MS-Off Ver
    Darth Office 2010
    Posts
    3,950

    Re: Run macros in protected sheets

    Quote Originally Posted by scara View Post
    if I only want shhe3 shhet to be protected?
    Must be cold in Sweden, are you shhhhivering

    Dom
    "May the fleas of a thousand camels infest the crotch of the person who screws up your day and may their arms be too short to scratch..."

    Use code tags when posting your VBA code: [code] Your code here [/code]

    Remember, saying thanks only takes a second or two. Click the little star to give some Rep if you think an answer deserves it.

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Run macros in protected sheets

    Do you mean
    Please Login or Register  to view this content.
    Last edited by royUK; 01-27-2011 at 01:32 PM.

  7. #7
    Registered User
    Join Date
    11-25-2010
    Location
    Stockholm, sweden
    MS-Off Ver
    Excel 2007
    Posts
    15

    Re: Run macros in protected sheets

    Not quite I get an error message, run time error object required. please help with the whole code

    Please Login or Register  to view this content.
    Maybe it is something like

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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