I am finding Excel VBA is very unstable on a Mac. Among other things, the command ActiveSheet.Unprotect does not appear to be working.
If I run a macro that attempts to hide a column and even though I have 'ActiveSheet.Unprotect', I still get an error "Alert - The cell or chart you are trying to change is on a protected sheet. To make a change, unprotect the sheet. You might me requested to enter a password."
When I click on "OK" the code continues correctly.
Does anyone have any suggestions to stop the alert message?
THe code is below.
If I run a macro that attempts to hide a column and even though I have 'ActiveSheet.Unprotect', I still get an error "Alert - The cell or chart you are trying to change is on a protected sheet. To make a change, unprotect the sheet. You might me requested to enter a password."
When I click on "OK" the code continues correctly.
Does anyone have any suggestions to stop the alert message?
THe code is below.
VBA Code:
Sub Hide_Memo_Col()
Dim HeaderRng As Range
Dim c As Range
ActiveSheet.Unprotect
OptimizeCode_Begin
Set HeaderRng = ActiveSheet.Range("AllBudgetHeaders")
For Each c In HeaderRng
If c Like "Ck Memo or Savings Code" Then
c.EntireColumn.Hidden = Not c.EntireColumn.Hidden
Exit For
End If
Next c
OptimizeCode_End
ActiveSheet.Protect
End Sub