Protected cell error : Cell Protected « Excel « VBA / Excel / Access / Word






Protected cell error

 

Sub ResetValues2()
    For i = 1 To Worksheets.Count
    On Error GoTo errorHandler
        For Each n In Worksheets(i).UsedRange
            If IsNumeric(n) Then
                If n.Value <> 0 Then
                     n.Value = 0
    ProtectedCell:
                End If
            End If
        Next n
    errorHandler:
        If Err = 1005 Then
             Resume ProtectedCell
        End If
    Next i
End Sub

 








Related examples in the same category