Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hide/unhide rows with macro in a protected sheet

Status
Not open for further replies.

dawnd3

Instructor
Jul 1, 2001
1,153
0
0
US
Hi there, In Excel 2000, I have a protected sheet (with password) that I would like to be able to click a button and have it unprotect the sheet, unhide the next availalbe row and rehide the rest, then reprotect the sheet again. (there are 60 rows set up for names and calculations, however we only show 30 rows and just unhide additional rows as needed.) We would like the user to NOT have to unprotect the sheet to do this because they usually forget to reprotect it and mess with the calculations. Is there some simple code that will help me do this? I am not quite sure how to have VBA determine what is the next available row.

Thanks,

Dawn
 
Hello,
you can use this as a basis for what you require.

sub protecthide(Rowref as integer)
'unprotect - no effect if sheet is not protected
activesheet.unprotect password:="Password"

Rows(Rowref + 1).Select
Selection.EntireRow.Hidden = False

rows(rowref).select
Selection.EntireRow.Hidden = True

'protect
activesheet.protect password:="Password"
end sub

[afro2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top