Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default VB list box print reports. Known # of columns. # rows unknown

I have a Listbox with a number of reports. I know the number of columns in
the report but not the number of rows in the report. This will vary based on
data. How do I set the print area in VB when I don't know the number of rows.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default VB list box print reports. Known # of columns. # rows unknown

One way, assuming your data begins in cell A1.

Set rng = ActiveSheet.Range(Cells(1, 1), _
Cells(UsedRange.Rows.Count, UsedRange.ColumnsCount))
ActiveSheet.PageSetUp.PrintArea = rng



"Richard" wrote in message
...
I have a Listbox with a number of reports. I know the number of columns in
the report but not the number of rows in the report. This will vary based
on
data. How do I set the print area in VB when I don't know the number of
rows.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default VB list box print reports. Known # of columns. # rows unknown

P.S. Unless you have page breaks assigned in your worksheet, Excel will
normally query the printer interface and determine how to paginate the used
range. It will then print the entire printable area without the user having
to set a print range. You only have to be concerned if there is data
somewhere in a remote area of the worksheet that would cause unneeded blank
pages to be printed.


"JLGWhiz" wrote in message
...
One way, assuming your data begins in cell A1.

Set rng = ActiveSheet.Range(Cells(1, 1), _
Cells(UsedRange.Rows.Count, UsedRange.ColumnsCount))
ActiveSheet.PageSetUp.PrintArea = rng



"Richard" wrote in message
...
I have a Listbox with a number of reports. I know the number of columns in
the report but not the number of rows in the report. This will vary based
on
data. How do I set the print area in VB when I don't know the number of
rows.





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
wrap columns to print in rows jenn Excel Discussion (Misc queries) 1 November 26th 09 04:17 PM
Print Area Set for Columns but Not Rows Swingdancer42 Excel Programming 5 February 9th 09 11:12 PM
excell does not print rows or columns dan Excel Discussion (Misc queries) 1 December 18th 06 03:16 AM
Want to print only rows that have value in certain columns- Excel pwalk Excel Discussion (Misc queries) 2 June 15th 06 06:23 PM
Print multiple reports from list validation Zilla[_3_] Excel Programming 3 June 12th 06 01:30 PM


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

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"