...
...
Running this code with an area selected will turn all the 'unlocked' cells
red
Sub HighlightUnlocked()
Dim myCell As Range
For Each myCell In Selection
If Not myCell.Locked Then
myCell.Interior.Color = RGB(255, 0, 0)
End If
Next myCell
End Sub
...
But no way to undo this easily. Better just to select those cells. Maybe
overkill, but I believe the following is the quickest approach.
Sub SelUnprot()
Dim ows As Worksheet, tws As Worksheet, icm As Long
If Not TypeOf ActiveSheet Is Worksheet Then Exit Sub
On Error GoTo CleanUp
Application.EnableEvents = False
Application.ScreenUpdating = False
Application.DisplayAlerts = False
icm = Application.Calculation
Application.Calculation = xlCalculationManual
Set ows = ActiveSheet
Set tws = ActiveWorkbook.Sheets.Add
Worksheets(Array(ows.Name, tws.Name)).Select
ows.Activate
ows.UsedRange.Select
tws.Select
Selection.FormulaR1C1 = "=CELL(""Protect"",'" & ows.Name & "'!RC)"
Selection.Value = Selection.Value
Selection.Replace what:="1", Replacement:=""
Worksheets(Array(ows.Name, tws.Name)).Select
ows.Activate
ows.UsedRange.Select
tws.Activate
Selection.SpecialCells(Type:=xlCellTypeConstants).Select
tws.Select
tws.Delete
CleanUp:
Application.Calculation = icm
If icm <> xlCalculationManual Then Application.Calculate
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub