View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Bruce Roberson Bruce Roberson is offline
external usenet poster
 
Posts: 47
Default Approach to a Menu of Multiple Print Ranges

Stephen:

I guess I'm in over my head at this point. I don't have
any experience with list boxes. I guess I need someone to
point me to an online tutorial to where i can follow your
instructions better on how to go about setting this stuff
up.
-----Original Message-----
Hi Bruce,

I just need someone to get me started with some
code that might allow for manageing all these reports

that
I print each month a little easier. In summary for the
sake of discussion, there are six different

subcategories
with each subcategories having two or more separate

print
ranges to print each month.


In that case, I would have a separate sheet somewhere

(called
shtLookup, say) that contains a table listing the

category,
subcategory, sheet and range to print for each report:

A B
1 Category 1
2 Report 1.1 Sheet1!A1:G20
3 Report 1.2 Sheet1!A21:G30
4 Category 2
5 Report 2.1 Sheet2!A1:H30

Then just have a userform containing a 2-column (with

ColumnWidth of ;0
to hide the second column) multi-select list box and an

Print button.
Your form would then have the code:

Private Sub UserForm_Initialize()
lbReports.List = ThisWorkbook.Worksheets("shtLookup")

_
.Range("A1").CurrentRegion
End Sub

Private Sub btnPrint_Click()

Dim i As Integer

With lbReports
For i = 0 To .ListCount
If .Selected(i) And .List(i, 1) < "" Then
Range(.List(i, 1)).PrintOut
End If
Next
End With

End Sub



Regards

Stephen Bullen
Microsoft MVP - Excel
www.BMSLtd.co.uk

.