View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Rowan Drummond[_3_] Rowan Drummond[_3_] is offline
external usenet poster
 
Posts: 414
Default Protecting cells by coluor

Protects all cells which are coloured Light Yellow (colour index 36):

Sub PrtcColor()
Dim cell As Range
With ActiveSheet
.Unprotect
For Each cell In .UsedRange
If cell.Interior.ColorIndex = 36 Then
cell.Locked = True
Else
cell.Locked = False
End If
Next cell
.Protect
End With
End Sub

Hope this helps
Rowan

st120869 wrote:
I have used 3 colours in my spreadsheet 1 for headings /titles, 1 for
data entry and 1 for calculated fields. How can I protect all cells
with a specific colour to prevent users from changing contents /
formula