If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Filter a multi demensional array?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-04-09, 13:53
mikezx10 mikezx10 is offline
Registered User
 
Join Date: Oct 2003
Posts: 226
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
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
Reply With Quote
  #2 (permalink)  
Old 06-14-09, 20:15
norie norie is offline
Registered User
 
Join Date: Mar 2006
Posts: 163
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?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On