Hide Excel row in VBA

  • Thread starter Thread starter RichC
  • Start date Start date
R

RichC

Help! I'm using Excel 97 and I am trying to hide a
spreadsheet row using VBA. This code is not working:

activesheet.Rows("28").Hidden = True

The message is 'unable to set the Hidden property of the
Range class.' The sheet is not protected.

Any suggestions?

Rich
 
How are you running the code?

If it's from a control from the control toolbox toolbar, try adding:

activecell.activate

near the top of your code.

(or change the .takefocusonclick to false (if the control has that property.))
 
I use something like
activecell.entirerow.hidden = true

or

Rows("28").EntireRow.Hidden = True

Either should work.

Rodney.
 
Not if the problem is as Dave Peterson suggests.

--
Regards,
Tom Ogilvy

Rodney Baker said:
I use something like
activecell.entirerow.hidden = true

or

Rows("28").EntireRow.Hidden = True

Either should work.

Rodney.
 
Back
Top