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
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
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
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
>
>
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
>
>
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
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks