ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Collapsing rows (https://www.excelbanter.com/excel-programming/393080-collapsing-rows.html)

Curious

Collapsing rows
 
I am writing categories of data (a category covers several rows) to an Excel
sheet, one category after another. I would like to collapse the rows
containing a category when all category data are entered. So the question is
how to programmatically collapse a number of rows after filling them with
data.

Thanks


Tom Ogilvy

Collapsing rows
 
Range("A10").Resize(8).EntireRow.Hidden = True

just to demo:

? Range("A10").Resize(8).EntireRow.Address
$10:$17


or maybe something like

ActiveCell.offset(-7,0).Resize(7).EntireRow.Hidden = True

demo'd again:
? activeCell.Address
$A$19
? ActiveCell.offset(-7,0).Resize(7).EntireRow.Address
$12:$18

so I am sitting in cell A19 after making 7 entries in cells A12:A18. Run
the macro and they are hidden and I begin the new category in A19.



--
Regards,
Tom Ogilvy


"curious" wrote:

I am writing categories of data (a category covers several rows) to an Excel
sheet, one category after another. I would like to collapse the rows
containing a category when all category data are entered. So the question is
how to programmatically collapse a number of rows after filling them with
data.

Thanks



All times are GMT +1. The time now is 07:43 AM.

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