Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Hide blank rows - what is wrong with this code ???

Hi ,

I have a divisional income statement which has the following formula to hide
any rows relating to a particular division if the balance is "zero".

It worked ok until I extended the print area at the bottom of the
spreadsheet. The code below ends well before that. It still hides rows but
prints the page with the hidden division. Previously it did not "print" a
page if the division was hidden. I do not want a page printed if the division
is hidden.



' Note that you can also use a Do While Not IsEmpty(ActiveCell) loop.
Sub Hide_Blanks()

Range("AU14").Select

' Test contents of active cell; if active cell is "end"
Do Until ActiveCell = "end"

ActiveCell.Select
If ActiveCell = "Hide" Then Call hideblanks

'Hide contains the following formula
=IF(SUM(V623+Z623+AD623+V619+Z619+AD619+V615+Z615+ AD615+V604+Z604+AD604+V598+Z598+AD598+AD592+Z592+V 592+V590+Z590+AD590+AD581+Z581+V581)=0,"Hide","No" )
; cell refs differ for each division'

' Step down 1 row to the next cell.
ActiveCell.Offset(1, 0).Select

' Return to top of loop.
Loop

Range("a8").Select

End Sub
Sub hideblanks()

ActiveCell.Select
ActiveCell.Offset(1, 0).Select
ActiveCell.PageBreak = False
ActiveCell.Offset(-1, 0).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.EntireRow.Hidden = True
Selection.End(xlDown).Select
ActiveCell.Offset(-1, 0).Select
End Sub

Any help would be appreciated.

Thanks


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Hide blank rows - what is wrong with this code ???

You probably need an addition to reset the print area.
Probably do NOT need the page break line. Excel doesn't print hidden rows.

It looks like the whole thing is a bit clumsy. Post your layout or, if
desired, send your wb to my private address below along with detailed
instructions of your desires.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"manfareed" wrote in message
...
Hi ,

I have a divisional income statement which has the following formula to
hide
any rows relating to a particular division if the balance is "zero".

It worked ok until I extended the print area at the bottom of the
spreadsheet. The code below ends well before that. It still hides rows but
prints the page with the hidden division. Previously it did not "print" a
page if the division was hidden. I do not want a page printed if the
division
is hidden.



' Note that you can also use a Do While Not IsEmpty(ActiveCell) loop.
Sub Hide_Blanks()

Range("AU14").Select

' Test contents of active cell; if active cell is "end"
Do Until ActiveCell = "end"

ActiveCell.Select
If ActiveCell = "Hide" Then Call hideblanks

'Hide contains the following formula
=IF(SUM(V623+Z623+AD623+V619+Z619+AD619+V615+Z615+ AD615+V604+Z604+AD604+V598+Z598+AD598+AD592+Z592+V 592+V590+Z590+AD590+AD581+Z581+V581)=0,"Hide","No" )
; cell refs differ for each division'

' Step down 1 row to the next cell.
ActiveCell.Offset(1, 0).Select

' Return to top of loop.
Loop

Range("a8").Select

End Sub
Sub hideblanks()

ActiveCell.Select
ActiveCell.Offset(1, 0).Select
ActiveCell.PageBreak = False
ActiveCell.Offset(-1, 0).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.EntireRow.Hidden = True
Selection.End(xlDown).Select
ActiveCell.Offset(-1, 0).Select
End Sub

Any help would be appreciated.

Thanks



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Hide blank rows - what is wrong with this code ???

Don,

Thanks for your reply. I will email yourself a copy of the spreadsheet.

Regards,

Manir

"Don Guillett" wrote:

You probably need an addition to reset the print area.
Probably do NOT need the page break line. Excel doesn't print hidden rows.

It looks like the whole thing is a bit clumsy. Post your layout or, if
desired, send your wb to my private address below along with detailed
instructions of your desires.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"manfareed" wrote in message
...
Hi ,

I have a divisional income statement which has the following formula to
hide
any rows relating to a particular division if the balance is "zero".

It worked ok until I extended the print area at the bottom of the
spreadsheet. The code below ends well before that. It still hides rows but
prints the page with the hidden division. Previously it did not "print" a
page if the division was hidden. I do not want a page printed if the
division
is hidden.



' Note that you can also use a Do While Not IsEmpty(ActiveCell) loop.
Sub Hide_Blanks()

Range("AU14").Select

' Test contents of active cell; if active cell is "end"
Do Until ActiveCell = "end"

ActiveCell.Select
If ActiveCell = "Hide" Then Call hideblanks

'Hide contains the following formula
=IF(SUM(V623+Z623+AD623+V619+Z619+AD619+V615+Z615+ AD615+V604+Z604+AD604+V598+Z598+AD598+AD592+Z592+V 592+V590+Z590+AD590+AD581+Z581+V581)=0,"Hide","No" )
; cell refs differ for each division'

' Step down 1 row to the next cell.
ActiveCell.Offset(1, 0).Select

' Return to top of loop.
Loop

Range("a8").Select

End Sub
Sub hideblanks()

ActiveCell.Select
ActiveCell.Offset(1, 0).Select
ActiveCell.PageBreak = False
ActiveCell.Offset(-1, 0).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.EntireRow.Hidden = True
Selection.End(xlDown).Select
ActiveCell.Offset(-1, 0).Select
End Sub

Any help would be appreciated.

Thanks




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default Hide blank rows - what is wrong with this code ???

Hi,

I have just emailed the wb to your private address.

Thanks,

Manir

"Don Guillett" wrote:

You probably need an addition to reset the print area.
Probably do NOT need the page break line. Excel doesn't print hidden rows.

It looks like the whole thing is a bit clumsy. Post your layout or, if
desired, send your wb to my private address below along with detailed
instructions of your desires.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"manfareed" wrote in message
...
Hi ,

I have a divisional income statement which has the following formula to
hide
any rows relating to a particular division if the balance is "zero".

It worked ok until I extended the print area at the bottom of the
spreadsheet. The code below ends well before that. It still hides rows but
prints the page with the hidden division. Previously it did not "print" a
page if the division was hidden. I do not want a page printed if the
division
is hidden.



' Note that you can also use a Do While Not IsEmpty(ActiveCell) loop.
Sub Hide_Blanks()

Range("AU14").Select

' Test contents of active cell; if active cell is "end"
Do Until ActiveCell = "end"

ActiveCell.Select
If ActiveCell = "Hide" Then Call hideblanks

'Hide contains the following formula
=IF(SUM(V623+Z623+AD623+V619+Z619+AD619+V615+Z615+ AD615+V604+Z604+AD604+V598+Z598+AD598+AD592+Z592+V 592+V590+Z590+AD590+AD581+Z581+V581)=0,"Hide","No" )
; cell refs differ for each division'

' Step down 1 row to the next cell.
ActiveCell.Offset(1, 0).Select

' Return to top of loop.
Loop

Range("a8").Select

End Sub
Sub hideblanks()

ActiveCell.Select
ActiveCell.Offset(1, 0).Select
ActiveCell.PageBreak = False
ActiveCell.Offset(-1, 0).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.EntireRow.Hidden = True
Selection.End(xlDown).Select
ActiveCell.Offset(-1, 0).Select
End Sub

Any help would be appreciated.

Thanks




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
Hide Blank Rows TamIam Excel Worksheet Functions 3 May 6th 09 08:42 PM
VBA code to hide blank rows ub Excel Worksheet Functions 4 July 31st 08 01:44 PM
How to hide rows, but not blank rows used for formatting hko78 Excel Programming 10 May 14th 08 07:58 PM
Slow Running Code to Hide Blank Rows Aaron Excel Programming 3 January 10th 07 03:17 AM
hide blank rows violet Excel Programming 3 November 9th 06 09:20 AM


All times are GMT +1. The time now is 12:08 PM.

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

About Us

"It's about Microsoft Excel"