Hide column with locked cells

R

Robert H

I have a worksheed that a users input data useing data validation.
There are cloumns on the sheet that display data based on selections
made in adjacent columns. The cells in these 'display column" contain
formulas that I need to protect but I also want to enable the user to
hide the display column to decluter if they need to. As best I can
teel you cannot hide/unhide a column with locked cells. Is there a
method or work around to do this?
 
G

Gord Dibben

Sub hide_unhide()
ActiveSheet.Unprotect Password:="justme"
With Columns("C:E")
If .EntireColumn.Hidden = False Then
.EntireColumn.Hidden = True
Else: .EntireColumn.Hidden = False
End If
End With
ActiveSheet.Protect Password:="justme"
End Sub


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top