Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Rows won't hide?
I have a large sheet with with some headers and totals at the top.
Some of the rows are needed for information, but shouldn't be displayed on the screen. At the end of generating the sheet, I loop over the lines and set these rows to 0 RowHeight. Each group of lines also has a separate header line, otherwise blank. If all of the details lines are hidden, I want to the header line to hide too. So I did this... i = 5 While i < lastRow ' see if this is a program, and where it starts and ends pstart = ast.Range("FD" & i) pend = ast.Range("FE" & i) If IsEmpty(pstart) Or IsEmpty(pend) Then GoTo TRYHIDINGNEXTPROG ' check the row height, assuming this will return something useful, ' and then hide the program header h = ast.Range("A" & pstart & ":A" & pend).RowHeight If IsNull(h) Or h = 0 Then ast.Rows(pstart - 1).RowHeight = 0 End If ' we've checked this program, move onto the next one i = pend TRYHIDINGNEXTPROG: i = i + 1 Wend pstart and pend are accurate recordings of the start and end of every group. When I run the above code, many of the "empty groups" do hide properly, but a small number don't. When I loop through the code by hand looking for the problem, it works perfectly every time. I can't find the problem no matter what I do. Can anyone suggest a reason for this behavior? Maury |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro code to hide rows and not calculate hidden rows | Excel Discussion (Misc queries) | |||
Enabling option „Format rows“ to hide/unhide rows using VBA-code? | Excel Discussion (Misc queries) | |||
hide multiple rows based on condition within rows | Excel Programming | |||
Hide Rows (Current Date) / Unhide Rows | Excel Programming | |||
Specify which rows to NOT hide, and have excel hide the rest | Excel Programming |