Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Bill Renaud wrote:
I forgot to add that this code works only as long as the worksheet has NOT been protected yet. If the worksheet has been protected, then an error will be raised. I rewrote the routine slightly as: '---------------------------------------------------------------------- Public Sub FormatMarksRange() Dim wsMarks As Worksheet Dim blnProtected As Boolean Dim rngMarks As Range Set rngMarks = Range("Marks") Set wsMarks = rngMarks.Parent blnProtected = wsMarks.ProtectContents If blnProtected Then wsMarks.Unprotect With rngMarks .FormatConditions.Delete .FormatConditions.Add Type:=xlExpression, _ Formula1:="=CELL(""protect"",RC)" .FormatConditions(1).Interior.ColorIndex = 24 End With If blnProtected Then wsMarks.Protect End Sub Excellent. Thank you, Bill, for your clear explanation of RC and your suggested enhancements to my routine. This is clearly the way to go rather than an iterative solution. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Conditional Formatting on Range of Cells | Excel Worksheet Functions | |||
Conditional Formatting to a RANGE of cells | Excel Discussion (Misc queries) | |||
suppress conditional formatting programmatically | Excel Discussion (Misc queries) | |||
Setting up formatting for a range of cells | Excel Discussion (Misc queries) | |||
Conditional formatting of a range of cells? | Excel Programming |