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
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.

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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,059
Messages
5,835,166
Members
430,343
Latest member
t0m_c

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top