View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] ma_hutchins@hotmail.com is offline
external usenet poster
 
Posts: 4
Default Unprotect from Forms Listbox

Using Excel 2000, I have a simple macro to hide or show a column
depending on the choice made from a list box (forms) control on the
worksheet:

Sub ModelSelect_Change()
On Error Resume Next
ActiveCell.Activate
ActiveSheet.Unprotect
If Range("ModelSelect").Value = 1 Then
'Hide it
Columns("E:E").Select
Selection.EntireColumn.Hidden = True
Else
'Show it
Columns("D:F").Select
Selection.EntireColumn.Hidden = False
End If
ActiveSheet.Protect
End Sub

However, the unprotect fails and Excel tells me "the cell or chart you
are trying to change is protected....", etc. and tells me to remove the
protection which is, of course, what the macro is attempting to do!
Where am I going wrong?
Cheers......Mike