+ Reply to Thread
Results 1 to 5 of 5

is sheet protected?

  1. #1
    רוזנט
    Guest

    is sheet protected?

    i want to paint some cells in red if the activesheet is not protected
    (conditional formatting)

    ather question:
    a vba code "if the activesheet is unprotected then...."

    thank you
    rozent

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello ×¨×•×–× ×˜,

    In VBA...
    If ActiveSheet.ProtectionMode = True Then
    ActiveSheet.Range(MyRange).Interior.ColorIndex = 3
    End If

    MyRange is the range you want to color red.

    Sincerely,
    Leith Ross

  3. #3
    רוזנט
    Guest

    Re: is sheet protected?

    thank you
    what about the first part of my question:
    " i want to paint some cells in red if the activesheet is not protected
    (by conditional formatting)" not vba

    rozent

    "Leith Ross" wrote:

    >
    > Hello ×¨×•×–× ×˜,
    >
    > In VBA...
    > If ActiveSheet.ProtectionMode = True Then
    > ActiveSheet.Range(MyRange).Interior.ColorIndex = 3
    > End If
    >
    > MyRange is the range you want to color red.
    >
    > Sincerely,
    > Leith Ross
    >
    >
    > --
    > Leith Ross
    > ------------------------------------------------------------------------
    > Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
    > View this thread: http://www.excelforum.com/showthread...hreadid=557637
    >
    >


  4. #4
    רוזנט
    Guest

    Re: is sheet protected?

    sory but it dosnt work
    i tried this:

    Sub if_protected()
    On Error Resume Next
    If ActiveSheet.ProtectionMode = True Then
    'ActiveSheet.Range(MyRange).Interior.ColorIndex = 3
    MsgBox "protected"
    Exit Sub
    Else
    MsgBox "not protected"
    End If
    End Sub

    i get all ways "not protected"

    rozent

    "Leith Ross" wrote:

    >
    > Hello ×¨×•×–× ×˜,
    >
    > In VBA...
    > If ActiveSheet.ProtectionMode = True Then
    > ActiveSheet.Range(MyRange).Interior.ColorIndex = 3
    > End If
    >
    > MyRange is the range you want to color red.
    >
    > Sincerely,
    > Leith Ross
    >
    >
    > --
    > Leith Ross
    > ------------------------------------------------------------------------
    > Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
    > View this thread: http://www.excelforum.com/showthread...hreadid=557637
    >
    >


  5. #5
    Dave Peterson
    Guest

    Re: is sheet protected?

    You can protect a few different things on a worksheet.

    Dim wks as worksheet
    set wks = activesheet

    If wks.ProtectContents _
    Or wks.ProtectDrawingObjects _
    Or wks.ProtectScenarios Then
    msgbox "It's protected"
    Else
    'do the work to add the conditional formatting
    end if



    ????? wrote:
    >
    > i want to paint some cells in red if the activesheet is not protected
    > (conditional formatting)
    >
    > ather question:
    > a vba code "if the activesheet is unprotected then...."
    >
    > thank you
    > rozent


    --

    Dave Peterson

+ 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