Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2003

    Unanswered: Filter a multi demensional array?

    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
    End Sub
    Sub runPrintJob(pt As Printtype)
    Dim wks As Worksheet


    For Each wks In ActiveWorkbook.Sheets
    selectArea wks, pt

    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

  2. #2
    Join Date
    Mar 2006
    What exactly are you trying to do with Filter?

    Is that meant to refer to a filter that's been applied to the data?

    Or are you somehow trying to use it to filter?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts