Excel Tips‎ > ‎

Finding unprotected cells

This little piece of VBA code helps identify any cells that have been left unprotected in a worksheet.
Simply open the VBA editor by pressing Alt+F11, then paste this text into a module.
Public Sub FindNextUnprotectedCell()
    Dim cell As Range
    ' Flag for found - set false
    Dim blnFound As Boolean
    blnFound = False
    For Each cell In ActiveSheet.UsedRange
        If cell.Locked = True Then
            ' Move on
            ' Not locked
            ' Select cell
            MsgBox "Found unprotected cell" & vbCrLf & cell.Address
            blnFound = True
        End If
    Next cell
    ' Message if none found
    If blnFound = False Then
        MsgBox "No unprotected cells found.", _
               vbInformation + vbOKOnly, _
               "Find Unprotected Cells"
    End If
End Sub