hiding rows on worksheets

  • Thread starter Thread starter bg18461
  • Start date Start date
B

bg18461

When I use:
Worksheets("JAN").Range("7:7,29:29,53:53").EntireRow.Hidden= True

or

Sheets("JAN").Range("7:7,29:29,53:53").Select
Selection.EntireRow.Hidden = True

I now get the error:
'Select method of Range class failed'

Any other suggestions
 
You would get that error with the code that uses Select if the Jan worksheet
were not active and visible at the time of running the code.

On the other hand

Worksheets("JAN").Range("7:7,29:29,53:53").EntireRow.Hidden= True

or

Worksheets("JAN").Range("A7,A29,A53").EntireRow.Hidden= True

will work as long as the Jan sheet is in the activeworkbook. I don't see how
you could get a "Select method" error when the code does not use the Select
method.

If Jan is not in the active workbook, use something like:

Workbooks("Book1.xls").Worksheets("JAN").Range("A7,A29,A53").EntireRow.Hidde
n= True
 

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

Back
Top