+ Reply to Thread
Results 1 to 3 of 3

Unlocking Macro in protected sheet

  1. #1
    Registered User
    Join Date
    10-28-2005
    Location
    Stockholm, Sweden
    Posts
    13

    Red face Unlocking Macro in protected sheet

    A simple question:

    - I have a rather large sheet with a lot of data in it.
    - In order to simplify sorting I recorded a few macros.
    - Since it is for government use I know a lot of people will be using it who don't know how not to change data that shouldn't be changed, I have protected the sheet.
    - Before locking the sheet I changed the properties of the cells that they should be able to change, unchecking the lock box.
    - When running the simple sorting macro VB tells me that I need to unlock the sheet even though the cells containing the macros are unlocked.

    Anyone got a tip on how I can get around this? I.e. I need to have the sheet protected while at the same time I want the macros activated.

  2. #2
    Registered User
    Join Date
    08-18-2005
    Posts
    3

    Unprotecting macros

    Your macro may be trying to update cells in your worksheet. It will not be able to do this if these cells are locked. e.g. If your macro carrys out a goal seek, changing one cell to match another, it will only do this if the cell it needs to change is not protected. i.e. it can write to this cell. Therefore what you need to do is unlock any cells which your macro needs to write to.
    Hope this helps.

  3. #3
    Registered User
    Join Date
    12-15-2004
    Posts
    5
    Start your macro with
    ActiveSheet.Unprotect

    and end it with
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True

    Good luck

+ 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