Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    is it protected ? (excel 97)

    I am trying to re-write a macro that got 'lost' during a recent laptop re-build. It was most useful as it went through the active workbook and listed the sheets into protected and unprotected.
    I am now unable to remember how to test each sheet to see if it is protected, can anyone help me please?
    I need something along the lines of :
    If sheet(sheetname).protected then
    but this produces a 438 error as the method/property doesnt exist!
    help!

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: is it protected ? (excel 97)

    Would the following help ?<pre> iSheets = ActiveWorkbook.Worksheets.Count
    For i = 1 To iSheets
    If Worksheets(i).ProtectContents = True Then
    'Do something
    Else
    'Do something else
    End If
    Next</pre>

    Andrew C

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: is it protected ? (excel 97)

    Spot on, thank you.

Posting Permissions

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