worksheet protection
It is an example to lock/unlock cells with formulas.
Sub LockCellsWithFormulas(passwd As String, Optional bLock As Boolean =
True)
Dim c As Object
ActiveSheet.Unprotect Password:=passwd
For Each c In ActiveSheet.UsedRange.Cells 'only in used range. If exist
more than 1 UsedRange then macro locks/unlocks only cells in first used
range
' For Each c In ActiveSheet.Cells 'in all worksheet
If c.Formula Like "=*" Then
c.Select
Selection.Locked = bLock
Selection.FormulaHidden = bLock
End If
Next c
If passwd < "" Then _
ActiveSheet.Protect Password:=passwd, DrawingObjects:=True, Contents:=True,
Scenarios:=True
End Sub
Uzytkownik "Todd" napisal w wiadomosci
...
Is there a way to select all cells without a formula and
unlock them? Maybe a macro? I want to protect all the
cells with formulas and leave the rest open to changes.
Right now all cells with data are locked. I have a lot
of worksheets so doing this manually will take a LONG time.
TIA
Todd
|