Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Code to colour Unlocked cells
I create a workbook with just one sheet, and make sure that
range("A1") is not Locked. With this book as the activeworkbook, I run this code: Sub Test_Protection() Dim ws As Worksheet, c As Range For Each ws In ActiveWorkbook.Worksheets With ws .Unprotect For Each c In .UsedRange.Columns("A:G") With c If Not c.Locked = True Then 'User is permitted to edit this cell, so color it: c.Interior.ColorIndex = 34 End If If Not .Range("A1").Locked = True Then .Range("A1").Interior.ColorIndex = 34 End If End With Next End With Next End Sub In this example, the 'c' code does not recognise that "A1" is not Locked, but the "A1" code does, and the cell is coloured correctly. Why is the line 'If Not c.Locked = True Then' failing please? Regards. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.692 / Virus Database: 453 - Release Date: 28/05/2004 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
VBA code to automatically colour cells depending on text? | Excel Discussion (Misc queries) | |||
How to change font colour in unlocked cell of protected sheet | Excel Discussion (Misc queries) | |||
paste locked cells and unlocked cells in protected sheet | Excel Worksheet Functions | |||
Moving from unlocked cells to unlocked cells in an excel form | Excel Worksheet Functions | |||
Tabbing through Unlocked cells | Excel Worksheet Functions |