Hi All, I have a workbook that is used as a service report. I developed the form in Excel 2010, and used it without problem with Excel 2010 and 2013. When I upgraded to Office 2016, the code that I was using to clear the data stopped working. It's saying that I'm trying to change cells in protected sheet. Well that's the point - I want to change only the values on the protected sheet with the cells that are unlocked, so I make sure first that the worksheet is protected. As I said, the code worked fine on Excel 2010 and 2013. Here it is:
Code:
Sub ClearUnlockedCells()
Dim msg As String, ans As Variant
msg = "Completing this action will delete all form data! Continue?"
ans = msgbox(msg, vbOKCancel, "Z-Models SCP Info")
Select Case ans
Case vbOK
Application.ScreenUpdating = False
'On Error Resume Next
Application.DisplayAlerts = False
For Each ws In ActiveWorkbook.Worksheets
With ws
.Cells.Value = vbNullString
End With
Next ws
Application.DisplayAlerts = True
Application.ScreenUpdating = True
Case vbCancel
End Select
Sheets("General Data").Range("B4").Select
End Sub
...any help is appreciated.