Hiding rows with cells locked using format protection lock functio

J

John G.

I have a macro that hides rows based on 0 value in certain rows in a single
column using autofilter. I have as a convenience, protected two columns of
data to the left of the sorted column so that user can just use the enter key
to pass over the two columns to the next allowable editable cell. But because
I have locked the cells in those columns, my macro will not collapse the
sheet based on 0 values next to the cells that are locked. My feeling is that
I won't be able to get around this. Or can I?...
 
G

Gord Dibben

You could add an unprotect line to your code, do the collapse then re-protect
the sheet.

Sub foo()

ActiveSheet.Unprotect Password:="justme"
'your code rund here
ActiveSheet.Protect Password:="justme"

End Sub


Gord Dibben MS Excel MVP
 
J

John G.

My brain gets muddled and can't see the forrest for the trees. There is
always a work around. Thanks!
 
G

Gord Dibben

Happy to help.

Thanks for the feedback.

I think "rund" was to be "runs"


Gord
 

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