egemencoskun
New Member
- Joined
- Feb 9, 2010
- Messages
- 19
Hi,
I have a code that goes through various sheets within the workbook and clear unprotected cells. Which have been working perfectly fine until I upgraded to Excel 2016. Frustrating and annoying as could not find the reason.
Code is below;
Run Time Error: 1004
Application-Defined or Object Defined Error
And debug is showing below line
When I tried to actually select UsedRange in ActiveWorksheet then selection delete it says that I am trying to clear contents from protected cells.
I also tried if range locked test but that one failed too.
I am totally stuck.
I have a code that goes through various sheets within the workbook and clear unprotected cells. Which have been working perfectly fine until I upgraded to Excel 2016. Frustrating and annoying as could not find the reason.
Code is below;
Code:
Dim wks As Worksheet
On Error Resume Next
For Each wks In Worksheets
Select Case wks.Name
Case "Authorise", "ATM Rec", "PC Exp", "Token Ctrl", "Cash Bingo", "Bingo Express", "Col Day Rec", "Mach Move", "Float", "PR1", "National Bingo", "Bingo Plus", "Admission", "PR1 (F)"
wks.UsedRange.Value = vbNullString
Case "Data", "UserData", "HOME", "Blank", "Input", "Checks"
' do nothing
End Select
Next wks
Run Time Error: 1004
Application-Defined or Object Defined Error
And debug is showing below line
Code:
wks.UsedRange.Value = vbNullString
When I tried to actually select UsedRange in ActiveWorksheet then selection delete it says that I am trying to clear contents from protected cells.
I also tried if range locked test but that one failed too.
I am totally stuck.