View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ken Johnson Ken Johnson is offline
external usenet poster
 
Posts: 1,073
Default lock all cells of a certain color


TxRaistlin wrote:
Haven't found this yet in previous threads, but I'm sure i missed it.

I am trying to Lock all cells that are a certain color as follows:

Sub lock_all_tan()

For Each s In Sheets
For Each c In Cells
If c.ColorIndex = 40 Then
c.Locked = False
c.FormulaHidden = False
End If
Next
Next

End Sub

The above doesn't work at all, appreciate any help. Thanks, Jason


Hi Jason,

Change the two False values to True. False Unlocks and UnHides.

Ken Johnson