Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / November 2007

Tip: Looking for answers? Try searching our database.

Advanced filtering of Union of named Ranges

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
El Cuarto Mago - 21 Nov 2007 15:48 GMT
First off, apologies if this has been discussed elsewhere. I've been
looking for two days w/o success. First, I'll describe what I'm trying
to acomplish, what I have done so far and what I came here to get help
on.

I have a large set of data (8 points sampled every 45mS for 10
minutes) collected from a machine and saved as CSV. I'm not sure what
the users of this data are looking to analyze or specifically
concerned about studying. Therefore I made the graph dynamic. Specific
sets (COLUMNS) of this data are being graphed. The Graph is
dynamically plotting Dynamic series achieved by using Names ranges for
start cell and the end cell is an offset from the start cell.
Example Series Source Data:
Name ="MaxCurrentDieTempValue"
Values ='Temp Analysis.xls'!MaxCurrentDieTempValue
where
MaxCurrentDieTempValue
=OFFSET(MaxCurrentDieTempValueStartCell,StartPosition,,Length,)

Name ="DieCounter"
Values ='Temp Analysis.xls'!DieCounter
where
DieCounter=OFFSET(DieCounterStartCell,StartPosition,,Length,)

Start Position and length are controlled by two slider bars. This is
great as it allows the user to essentially pan and zoom in to the
specific area of interest. I also give the user the Max, Min, Diff and
deviation.

HERE'S THE PROBLEM:
I want to create a subset of the above data to report on the
individual dies (DieCounter = 0, Die Counter = 1, etc etc). I
therefore tried to programatically run an advanced filter on the union
of the two ranges to output a range where die counter is equal to some
value. I figured I could then either graph the results and (again) do
the Max, Min, Diff and stddev of the individual and compare it to the
overall.

I CAN'T GET THE FILTER TO WORK. Here's what I have

Sub Macro1()
   Dim rngToFilter As Range
   Dim rngTargetRange As Range

   Worksheets("Graph Sheet").Activate

   Set rngToFilter =
Application.Union(Range("MaxCurrentDieTempValue"),
Range("DieCounter"))

   rngToFilter.AdvancedFilter _
       Action:=xlFilterCopy, _
       CriteriaRange:=Worksheets("Graph Sheet").Range("G1:G2"), _
       CopyToRange:=Range(rngTargetRange), _
       Unique:=False

End Sub

WHERE CELL "G1" of "Graph Sheet" CONTAINS A "0". I should then be able
to create a graph series out of rngTargetRange and get the MIN, MAX,
etc, etc.

This seems like the right approach but I keep getting error 400.

Someone please help me.
El Cuarto Mago - 27 Nov 2007 16:07 GMT
I'm closer using what was pasted below. However still getting an error
400. I think because the "TestTargetRange" appears to consist of ONLY
one cell even though when pasted into a worksheet (by naming a cell
via drop down window on worksheet) it pastes two columns and over 1300
rows. I'm thinking I'll next try to resize the range using offset or
resize. It sure would be nice if someone more knowledgable than I
would help out.

 Dim rngToFilter As Range
   Dim rngTargetRange As Range
   Dim rngFilterCriteria As Range

   Range("M1:M2").Name = "rngFilterCriteria"

   Range("rngFilterCriteria").Cells(1).FormulaR1C1 =
"=""gctrDieCount.ACC"""
   Range("rngFilterCriteria").Cells(2).FormulaR1C1 = "=""7"""

   Union(Range("TestMaxCurrentDieTempValue"),
Range("TestDieCounterValue")).Copy _
   Destination:=Range("TestTargetRange")

   Range("TestTargetRange").AdvancedFilter Action:=xlFilterInPlace,
CriteriaRange:= _ ' this is where it breaks. - error 400. that error
400 is so lame.
       Range("rngFilterCriteria")
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.