Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Printing / December 2004

Tip: Looking for answers? Try searching our database.

How do I exclude a zero balance column from printing?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Wolf - 21 Dec 2004 21:01 GMT
I have a spreadsheet with 58 columns of potential data.  I have used the
"sniplet" that Frank posted to another user that gives the print area based
upon the number of rows utilized, so the print area is not a problem.  I have
tried tailoring the samples to remove blank columns, but I cannot get the
macro that would let me print out only those columns that have a value
greater than 0.  Ideally, the macro would hide those columns with zero
balances, print, then unhide those same columns.  Any suggestions?
Paul Cundle - 21 Dec 2004 23:55 GMT
> I have a spreadsheet with 58 columns of potential data.  I have used
> the "sniplet" that Frank posted to another user that gives the print
[quoted text clipped - 4 lines]
> would hide those columns with zero balances, print, then unhide those
> same columns.  Any suggestions?

If I understand the problem correctly (which isn't all that likely
considering I've been drinking...) then this sort of thing may be what
you're looking for:

Sub HideNilColumns()
columnsum = WorksheetFunction.Sum(Range("A1:A65535"))
If columnsum > 0 Then Columns("A:A").EntireColumn.Hidden = True
End Sub

You would obviously have to repeat the check for each relevant column and
add the appropriate code to unhide things afterwards. There's also a
possibility that the sum will equal zero if you have negative numbers which
exactly contra the positives. In this case, extra checks would need to be
added (perhaps by taking the absolute values of all the numbers in the
column? Not sure).

Paul C,
--
Wolf - 27 Dec 2004 14:49 GMT
Thank you Paul.  I was able to use what you suggested.

Thanks Again.

> > I have a spreadsheet with 58 columns of potential data.  I have used
> > the "sniplet" that Frank posted to another user that gives the print
[quoted text clipped - 23 lines]
> Paul C,
> --

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.