My company changed servers last week, so I've had to remap all my previous macros from my personal macro workbook. Other than that I haven't really made any changes. To make this more complex, this macro worked fine last week multiple times, yet now it doesn't seem to like me any longer.
Sub PerformClear()
Dim wkSht As Worksheet
'Test to be sure we are in the correct workbook and sheet
Set wkSht = ActiveSheet
If InStr(wkSht.Name, "Most Improved") = 1 Then Exit Sub
Ans = MsgBox("This will clear the active Report data." & vbCrLf + vbCrLf _
& " Click 'OK' to continue.", vbOKCancel + vbExclamation, "Perform Clear")
If Ans = vbCancel Then Exit Sub
Application.ScreenUpdating = False
If wkSht.Protect = False Then wkSht.Protect
It is failing on the wksht.protect line with the compile error expected function or variable.
It wont even start the code to assign the activesheet to the worksheet variable. I can immediate debug.print activesheet.protect = true and get a boolean response. I've manually assigned the worksheet variable and it works, but for whatever reason it just wont fire the code unless within the code I use activesheet. I'm flabbergasted as to what the deal is, or what change was made that suddenly cuased it to not work any longer. Thoughts/ideas would be appreciated.
Bookmarks