Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Aug 2002
    Location
    MN, USA
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Protecting sheet problem (2000)

    Hello,

    I have a worksheet that has a few rows that are hidden and shown by pushing the corresponding buttons. I have formulas within this sheet that I would like to protect, but once I protect the sheet my macro will not hide/unhide the rows because of the protection I just applied. I have tried unprotecting the particular rows that are hidden/shown but that doesn't work.

    When protecting the sheet, you are able to choose between 3 combo boxes (Contents, Objects, & Scenarios) and if I uncheck Contents my macro is able to work, but unfortunately the cell contents is what I'm trying to protect.

    Is there a way to protect my formulas but still have my hide/unhide rows macro work?

    An example of my code for hiding/unhiding the code is:
    Rows("17").Offset(i).EntireRow.Hidden = True

  2. #2
    Platinum Lounger
    Join Date
    Jan 2001
    Posts
    3,788
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Protecting sheet problem (2000)

    You can unprotect/protect your sheet in your code

    Sheet1.Unprotect "password"

    your code

    Sheet1.Protect "password"

  3. #3
    Lounger
    Join Date
    Aug 2002
    Location
    MN, USA
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting sheet problem (2000)

    Yup, that works. Thank you!

    One question with this. This event could be triggered from a button in another sheet. When I hit that button and it executes the 'Sheet1.Unprotect "pw"' line it flashes to that worksheet for a split second before returning to my current sheet. With both the protect and unprotect, it will flash twice. Is there a way to avoid this? It doesn't have an effect on anything, it's more just a nuisance.

    Thanks.

  4. #4
    Platinum Lounger
    Join Date
    Jan 2001
    Posts
    3,788
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Protecting sheet problem (2000)

    Use:

    Application.ScreenUpdating = FALSE
    .
    .
    Application.ScreenUpdating = TRUE

  5. #5
    Lounger
    Join Date
    Aug 2002
    Location
    MN, USA
    Posts
    49
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Protecting sheet problem (2000)

    Perfect, thanks!

Posting Permissions

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