hiding/unhiding rows

A

Art

I know I can create a macro that allows a user to, say, press CTRL-H and the
first three rows of my spreadsheet will become hidden. (Some users prefer
having more real estate space and have more rows show at one time.)

However, is there a way to force those rows to be unhidden when the
spreadsheet is reopened (especially if the previous user saved the
spreadsheet with the first three rows hidden)?

Thanks!!!
 
P

Paul C

You can run a macro when the sheet is opened using the Auto_Open

Private Sub Auto_Open()
'Do stuff like unhide rows
End Sub

Of course if the user has macros disabled this does not work.

As a alternative you could use a Before Save event.

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _
Cancel as Boolean)
'Unhide hidden rows
End Sub

This would ensure that the saved version has the rows unhidden since if they
were hidden via a macro, macros must be enabled. The disadvantage is that if
a user saves the rows would unhide even if they are not closing the file.

You could of course get fancy and program some kind of cancel funtion if
they are not closing. (MsgBox, custome form with message, etc..)
 

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