Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding rows programmatically
I would like to be able to hide consecutive rows in a workbook when the first row has the word Formula in Column A. The row with the word Formula in it will be contiguous with Data above it and may or may not have Rows with Data directly below it.
If possible, I would like to be able to unhide them as well. All such set of rows on a worksheet (there may be more than one Row starting with Formula per sheet) can be hidden and unhidden at the same time. Any help would be greatly appreciated. tj |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding rows programmatically
Most of the code is from the help example for FindNext
dim c as Range, rng as Range dim firstaddress as string With Worksheets(1) .Range(.Cells(1,1),.Cells(rows.count,1).end(xlup)) End with with rng Set c = .Find("Formula", lookin:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do if isempty(c.offset(1,0)) then c.Entirerow.Hidden = True else range(c,c.end(xldown)).EntireRow.Hidden = True end if Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With -- Regards, Tom Ogilvy "tjtjjtjt" wrote in message ... I would like to be able to hide consecutive rows in a workbook when the first row has the word Formula in Column A. The row with the word Formula in it will be contiguous with Data above it and may or may not have Rows with Data directly below it. If possible, I would like to be able to unhide them as well. All such set of rows on a worksheet (there may be more than one Row starting with Formula per sheet) can be hidden and unhidden at the same time. Any help would be greatly appreciated. tj |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Hiding rows programmatically
Thanks!
tj "Tom Ogilvy" wrote: Most of the code is from the help example for FindNext dim c as Range, rng as Range dim firstaddress as string With Worksheets(1) .Range(.Cells(1,1),.Cells(rows.count,1).end(xlup)) End with with rng Set c = .Find("Formula", lookin:=xlValues) If Not c Is Nothing Then firstAddress = c.Address Do if isempty(c.offset(1,0)) then c.Entirerow.Hidden = True else range(c,c.end(xldown)).EntireRow.Hidden = True end if Set c = .FindNext(c) Loop While Not c Is Nothing And c.Address < firstAddress End If End With -- Regards, Tom Ogilvy "tjtjjtjt" wrote in message ... I would like to be able to hide consecutive rows in a workbook when the first row has the word Formula in Column A. The row with the word Formula in it will be contiguous with Data above it and may or may not have Rows with Data directly below it. If possible, I would like to be able to unhide them as well. All such set of rows on a worksheet (there may be more than one Row starting with Formula per sheet) can be hidden and unhidden at the same time. Any help would be greatly appreciated. tj |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How can I delete rows programmatically based on certain criteria? | New Users to Excel | |||
Hiding a button when hiding rows | Excel Discussion (Misc queries) | |||
Deleting rows programmatically | Excel Worksheet Functions | |||
Selecting Rows Programmatically | Excel Programming | |||
Sorting rows programmatically | Excel Programming |