View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz[_2_] JLGWhiz[_2_] is offline
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.