Check Box Macro to hide and unhide a column
Just a guess...
Are you unprotecting (and reprotecting) the correct worksheet?
Depending on where you placed the code (General module or behind a worksheet),
you may have trouble using Activesheet.
Sub HideColumn_Area()
Sheets("Final").Unprotect
Dim myRng As Range
Dim myCbx As CheckBox
Set myRng = Worksheets("Final").Range("D:D")
Set myCbx = ActiveSheet.CheckBoxes(Application.Caller)
myRng.EntireColumn.Hidden = CBool(myCbx.Value = xlOn)
Sheets("Final").Protect DrawingObjects:=True, Contents:=True, _
Scenarios:=True
End Sub
And remember to pass the password if you used one.
Daphne wrote:
*Sorry... I mean when i apply the macros before i add in the code for
unprotecting and protecting the code, it still works, but when i add in
the code, the error msg stops me from advancing.
Please advise..
--
Dave Peterson
|