hide columns/rows/cells on open

  • Thread starter Thread starter notso
  • Start date Start date
N

notso

I want to automatically hide columns when the user opens a password protected
sheet or workbook. The users with the passwords sometimes leave the hidden
columns in unhidden when they save and close. How do I make sure that hidden
columns etc. are automatically hidden on all sheets when the workbook is
opened.
 
hi
you did say how many sheets or what columns to hide but here is the syntax...

Private Sub Workbook_Open()
Sheets("sheet1").Columns("C:C").EntireColumn.Hidden = True
Sheets("sheet2").Columns("C:C").EntireColumn.Hidden = True
End Sub

adjust to suit your data.
personally i would use the before save event and hidde on close instead of
open
might be just me.

Regards
FSt1
 
remembering that if it's protected you would need to unprotect to do this

Sheets("Sheet3").Unprotect Password:="MyPass"
Sheets("sheet3").Columns("C:C").EntireColumn.Hidden = True
Sheets("Sheet3").Protect Password:="MyPass"

Mike
 
Thank you. Is the same true if I hade on close? I tried this and decided not
to because the user is prompted to save the document and if they don't save
it, then the columns are not hidden when they re-open. Plus if the user does
not change anything I don't want them to get confused when the work book asks
them whether or not they want to save. If you can send me the code to hide
 

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

Back
Top