I need to set up multiple print areas for different views of the same sheet.
I was thinking of using an array and filtering it. I have a wks with the following set up
CodeName Daily(printRange) Monthly Yearly
Sheet6 r1 r2 r3
Sheet7 r4 ........ ........
Sheet8 ........ ........ ........
Sheet9 ........ ........ ........
Sheet10 ........ ........ ........
and here is the code, it ALMOST WORKS !! the problem is with the filtering im not sure how to do it and i get a type mismatch error when trying to filter the array
Any help apprecaited!
Private printInfo(20, 3) As String
Enum Printtype
All = 1
Expected = 2
Annual = 3
YTD = 4
End Enum
Sub btnExpected()
runPrintJob Printtype.Expected
End Sub
Sub btnAnnual()
runPrintJob Printtype.Annual
End Sub
Sub btnAll()
runPrintJob Printtype.All
End Sub
Sub btnYTD()
runPrintJob Printtype.YTD
End Sub
Sub readRanges()
Dim i As Integer
i = 0
While ActiveCell.Value <> vbNullString
printInfo(i, 0) = ActiveCell.Value
printInfo(i, 1) = ActiveCell.Offset(0, 1).Value
printInfo(i, 2) = ActiveCell.Offset(0, 2).Value
ActiveCell.Offset(1, 0).Select
i = i + 1
Wend
End Sub
Sub runPrintJob(pt As Printtype)
Dim wks As Worksheet
readRanges
For Each wks In ActiveWorkbook.Sheets
selectArea wks, pt
Next
End Sub
Sub selectArea(wks As Worksheet, pt As Printtype)
Dim printAddress As String
Dim arFiltered() As String
arFiltered = Filter(printInfo, CStr(wks.CodeName))
ActiveSheet.Range(arFiltered(0, pt)).Select
End Sub