Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 119
Default 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
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro code to hide rows and not calculate hidden rows bradmcq Excel Discussion (Misc queries) 0 September 1st 09 12:38 AM
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
hide multiple rows based on condition within rows Skymann Excel Programming 6 October 21st 07 04:01 PM
Hide Rows (Current Date) / Unhide Rows Joe K. Excel Programming 1 October 10th 07 05:37 PM
Specify which rows to NOT hide, and have excel hide the rest Mo2 Excel Programming 0 April 25th 07 03:44 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"