Hi all.
I am new to macros. I uses a macro to clear all unprotected cells in a workbook. It works perfectly in older versions. When i run the macro in 2016 it does nothing.
Here is the code:
Sub ClearUnlockedCells()
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
On Error Resume Next
wks.UsedRange.Value = vbNullString
Err.Clear: On Error GoTo -1: On Error GoTo 0
Next wks
Set wks = Nothing
End Sub
Please help
I am new to macros. I uses a macro to clear all unprotected cells in a workbook. It works perfectly in older versions. When i run the macro in 2016 it does nothing.
Here is the code:
Sub ClearUnlockedCells()
Dim wks As Worksheet
For Each wks In ThisWorkbook.Worksheets
On Error Resume Next
wks.UsedRange.Value = vbNullString
Err.Clear: On Error GoTo -1: On Error GoTo 0
Next wks
Set wks = Nothing
End Sub
Please help