Hide Excel row in VBA

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
 
D

Dave Peterson

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.))
 
R

Rodney Baker

I use something like
activecell.entirerow.hidden = true

or

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

Either should work.

Rodney.
 
T

Tom Ogilvy

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top