View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Having a cell display certain text or formatting when the worksheet is protected or unprotected

This handles the entire used range on the active sheet.
Change the range to suit...
'------------------------------
Sub ColorWhatsLocked()
Dim rngCell As Excel.Range
Application.ScreenUpdating = False
ActiveSheet.UsedRange.Interior.ColorIndex = xlColorIndexNone
For Each rngCell In ActiveSheet.UsedRange.Cells
If rngCell.Locked Then rngCell.Interior.ColorIndex = 3
Next 'rngCell
Application.ScreenUpdating = True
End Sub

Sub RemoveColor()
ActiveSheet.UsedRange.Interior.ColorIndex = xlColorIndexNone
End Sub
-------------
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware



"jonco"
wrote in message
Is there an easy way to have a cell display certain text or formatting when
the sheet is protected or unprotected? I'd like to have several cells,
A32:D32 be colored red (for instance) when the worksheet is unprotected.
You guys have been a GREAT help to me during this project. Thanks!!!!!
Jon