+ Reply to Thread
Results 1 to 5 of 5

Find Protected Cells

  1. #1
    ExcelMonkey
    Guest

    Find Protected Cells

    I know that I can lock cells and hide their formulas.

    Selection.Locked = True
    Selection.FormulaHidden = True

    I also know that none of this kicks in unless the sheet
    itself is protected.

    ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
    Scenarios:=True

    How do I tell if a cell is protected? What property am I
    tesing for? Is it first the sheet and then the cell?

    THanks



  2. #2
    Bob Phillips
    Guest

    Re: Find Protected Cells

    Surely, it is both, irrespective of order.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    > I know that I can lock cells and hide their formulas.
    >
    > Selection.Locked = True
    > Selection.FormulaHidden = True
    >
    > I also know that none of this kicks in unless the sheet
    > itself is protected.
    >
    > ActiveSheet.Protect DrawingObjects:=True, Contents:=True,
    > Scenarios:=True
    >
    > How do I tell if a cell is protected? What property am I
    > tesing for? Is it first the sheet and then the cell?
    >
    > THanks
    >
    >




  3. #3
    ExcelMonkey
    Guest

    Re: Find Protected Cells

    How do you wrap an If around the .Protect property for the
    active sheet given that it has three other conditions
    (DrawingObjects:=True, Contents:=True, Scenarios:=True)?
    I only care about the cells/formulas.


    If ActiveSheet.Protect Contents:=True Then
    'code here
    End if








    >-----Original Message-----
    >Surely, it is both, irrespective of order.
    >
    >--
    >
    >HTH
    >
    >RP
    >(remove nothere from the email address if mailing direct)
    >
    >
    >"ExcelMonkey" <[email protected]> wrote

    in message
    >news:[email protected]...
    >> I know that I can lock cells and hide their formulas.
    >>
    >> Selection.Locked = True
    >> Selection.FormulaHidden = True
    >>
    >> I also know that none of this kicks in unless the sheet
    >> itself is protected.
    >>
    >> ActiveSheet.Protect DrawingObjects:=True,

    Contents:=True,
    >> Scenarios:=True
    >>
    >> How do I tell if a cell is protected? What property am

    I
    >> tesing for? Is it first the sheet and then the cell?
    >>
    >> THanks
    >>
    >>

    >
    >
    >.
    >


  4. #4
    ExcelMonkey
    Guest

    Re: Find Protected Cells

    This seems to be working:

    Public Function CellHasProtection(rng As Range)
    If rng.Parent.Protect = True Then
    If rng.Locked = True Or rng.FormulaHidden = True Then
    CellHasProtection = True
    End If
    End If
    End Function

    thanks
    >-----Original Message-----
    >How do you wrap an If around the .Protect property for

    the
    >active sheet given that it has three other conditions
    >(DrawingObjects:=True, Contents:=True, Scenarios:=True)?
    >I only care about the cells/formulas.
    >
    >
    >If ActiveSheet.Protect Contents:=True Then
    > 'code here
    >End if
    >
    >
    >
    >
    >
    >
    >
    >
    >>-----Original Message-----
    >>Surely, it is both, irrespective of order.
    >>
    >>--
    >>
    >>HTH
    >>
    >>RP
    >>(remove nothere from the email address if mailing direct)
    >>
    >>
    >>"ExcelMonkey" <[email protected]>

    wrote
    >in message
    >>news:[email protected]...
    >>> I know that I can lock cells and hide their formulas.
    >>>
    >>> Selection.Locked = True
    >>> Selection.FormulaHidden = True
    >>>
    >>> I also know that none of this kicks in unless the sheet
    >>> itself is protected.
    >>>
    >>> ActiveSheet.Protect DrawingObjects:=True,

    >Contents:=True,
    >>> Scenarios:=True
    >>>
    >>> How do I tell if a cell is protected? What property

    am
    >I
    >>> tesing for? Is it first the sheet and then the cell?
    >>>
    >>> THanks
    >>>
    >>>

    >>
    >>
    >>.
    >>

    >.
    >


  5. #5
    Bob Phillips
    Guest

    Re: Find Protected Cells

    If you want to allow for any being set use OR

    With ActiveSheet
    If .ProtectContents OR .ProtectDrawingObjects OR _
    etc.

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "ExcelMonkey" <[email protected]> wrote in message
    news:[email protected]...
    > How do you wrap an If around the .Protect property for the
    > active sheet given that it has three other conditions
    > (DrawingObjects:=True, Contents:=True, Scenarios:=True)?
    > I only care about the cells/formulas.
    >
    >
    > If ActiveSheet.Protect Contents:=True Then
    > 'code here
    > End if
    >
    >
    >
    >
    >
    >
    >
    >
    > >-----Original Message-----
    > >Surely, it is both, irrespective of order.
    > >
    > >--
    > >
    > >HTH
    > >
    > >RP
    > >(remove nothere from the email address if mailing direct)
    > >
    > >
    > >"ExcelMonkey" <[email protected]> wrote

    > in message
    > >news:[email protected]...
    > >> I know that I can lock cells and hide their formulas.
    > >>
    > >> Selection.Locked = True
    > >> Selection.FormulaHidden = True
    > >>
    > >> I also know that none of this kicks in unless the sheet
    > >> itself is protected.
    > >>
    > >> ActiveSheet.Protect DrawingObjects:=True,

    > Contents:=True,
    > >> Scenarios:=True
    > >>
    > >> How do I tell if a cell is protected? What property am

    > I
    > >> tesing for? Is it first the sheet and then the cell?
    > >>
    > >> THanks
    > >>
    > >>

    > >
    > >
    > >.
    > >




+ 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