ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   locked cells (https://www.excelbanter.com/excel-programming/301839-locked-cells.html)

MillyMollyMandy

locked cells
 
I've heard there is a way of displaying which cells are
locked, a bit like showing the formulas.

I need to do this to provide a printout to prove that the
cells are protected.

Does anyone know how to do it?

Tom Ogilvy

locked cells
 
for each cell in ActiveSheet.Usedrange
if cell.locked = False then
cell.Interior.ColorIndex = 6
end if
Next
activesheet.printout
for each cell in ActiveSheet.Usedrange
if cell.locked = False then
cell.Interior.ColorIndex = xlNone
end if
Next

If you sheet doesn't have colors then the above might work.

an easier way might be to execute

Sub SetState()
Activesheet.EnableSelection = xlUnlockedCells
End Sub

then when protection is in effect, only the unlocked cells can be selected.

--
Regards,
Tom Ogilvy

"MillyMollyMandy" wrote in message
...
I've heard there is a way of displaying which cells are
locked, a bit like showing the formulas.

I need to do this to provide a printout to prove that the
cells are protected.

Does anyone know how to do it?





All times are GMT +1. The time now is 12:45 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com