ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   hiding rows on worksheets (https://www.excelbanter.com/excel-programming/317313-hiding-rows-worksheets.html)

bg18461[_12_]

hiding rows on worksheets
 

When I use:
Worksheets("JAN").Range("7:7,29:29,53:53").EntireR ow.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

--
bg1846
-----------------------------------------------------------------------
bg18461's Profile: http://www.excelforum.com/member.php...nfo&userid=887
View this thread: http://www.excelforum.com/showthread.php?threadid=31513


John Green[_4_]

hiding rows on worksheets
 
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").EntireR ow.Hidden= True

or

Worksheets("JAN").Range("A7,A29,A53").EntireRow.Hi dden= 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



--
John Green
Sydney
Australia


"bg18461" wrote in message
...

When I use:
Worksheets("JAN").Range("7:7,29:29,53:53").EntireR ow.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.


--
bg18461
------------------------------------------------------------------------
bg18461's Profile:

http://www.excelforum.com/member.php...fo&userid=8877
View this thread: http://www.excelforum.com/showthread...hreadid=315130





All times are GMT +1. The time now is 09:49 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com