I have tested it and it runs on my PC - so it must be something minor
Run this and look at the Immediate Window to see if it is failing from the first sheet or whether it's a particular sheet that is causing the problem.
To see the immediate window in VBA , Click on View, then "Immediate Window"
Sub UnlockBlue()
For Each sht In ActiveWorkbook.Sheets
Debug.Print sht.Name
sht.Unprotect Password:=""
Set Rng = sht.UsedRange
Debug.Print sht.Name & " " & Rng.Address(0, 0)
For Each cell In Rng
Debug.Print cell.Address(0, 0)
If cell.Interior.ColorIndex = 20 Then
cell.Locked = False
End If
Next cell
sht.Protect Password:=""
Next sht
End Sub
Bookmarks