English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I want to use a macro to hide and another to unhide rows in ms excel. But i also want to protect the sheet. The macro can't hide/unhide the protected rows. Is ther any way i can achive the level of protection for these rows and still have macros able to hide/unhide them?

2007-11-06 00:52:26 · 3 answers · asked by i am no fool 1 in Computers & Internet Programming & Design

3 answers

Simple, write your macro to unprotect, hide, protect to hide rows
and unprotect, unhide, protect to unhide rows

2007-11-06 01:04:17 · answer #1 · answered by Anonymous · 0 0

The Macro Recorder is a good way to learn how to do stuff. I'm sure you know how to protect and unprotect your worksheet and you also know how to hide and unhide rows. Just run the Macro Recorder as you protect and unprotect the worksheet and hide and unhide the rows. Then you can just go back and modify the code a little so that it runs more efficiently and does what you want.

The macro can work with the rows, but you just have to do a little thinking when you write/record the macro. Unprotect the worksheet first, make the row changes, then reprotect the worksheet with the macro before the it finishes.

2007-11-09 07:03:42 · answer #2 · answered by devilishblueyes 7 · 0 0

A macro can hide or unhide and protect or unprotect a worksheet. Use the following: There should be a space after ActiveSheet.Protect (I used a _ instead so it didn't move the parameters to the next line). The password you use is case sensitive.

Columns("B:B").Select
Selection.EntireRow.Hidden = True

ActiveSheet.Protect Password:="password",DrawingObjects:=True, Contents:=True, Scenarios:=True

2007-11-06 09:06:15 · answer #3 · answered by Anonymous · 1 0

fedest.com, questions and answers