Macro not working when protecting sheet

stenmark

New Member
Joined
Mar 15, 2005
Messages
23
Hi

-------------
Rows("22").Select
Selection.EntireRow.Hidden = False
Range("A1:C1").Select
-------------

Working fine until I protect the sheet...
Excel gives error message saying "property hidden cant be used for class range"....anyone know how to get around this?

Thanks in advace
 

Some videos you may like

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney

dumbo40

Board Regular
Joined
Nov 11, 2005
Messages
52
have you tried unlocking the macro button before protecting the worksheet?
 

erik.van.geit

MrExcel MVP
Joined
Feb 1, 2003
Messages
17,832
Hi, stenmark,

try something like this
Code:
ActiveSheet.Unprotect
Rows("22").EntireRow.Hidden = False
Range("A1:C1").Select
ActiveSheet.Protect
depending on your version there is a setting to allow "row-edits", when you protect a worksheet, but you don't seem to have Excel 2002 or higher (I think it was not there in 2000)

attention:
you don't have to select the row to edit it (see code without select)
kind regards,
Erik
 

Watch MrExcel Video

Forum statistics

Threads
1,118,169
Messages
5,570,654
Members
412,335
Latest member
cinciri99
Top