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 / January 2007

Tip: Looking for answers? Try searching our database.

Show only matches between a named cell range and the values in a page field - vba

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
maverick502 - 25 Jan 2007 14:33 GMT
I'm trying to create a macro in vba that will compare a list of items
in a named cell range to the values in a page field of a pivot table.
The named cell range is a subset of the complete list of values in the
page field of the pivot table. I want to hit a button and the pivot
table will automatically select only the subset of values. Any ideas?

I tried this, but the comparison between the pivot item value and the
array is obviuously not working.

Public Sub A4_24_MIX_Click()
   Dim MyValue As Variant
   Dim MyArray() As Variant

   MyValue = Sheets("Converters").Range("O1")
'i'm not even sure how to reference a named cell range - the cells
named range is "A4_MIX" and are cells L2:L63
   MyArray = ActiveWorkbook.Range(A4_MIX)

   For i = 1 To MyValue
       If
ActiveSheet.PivotTables("PivotTable1").PivotFields("MDS").PivotItems(i).Value
<> MyArray Then

ActiveSheet.PivotTables("PivotTable1").PivotFields("MDS").PivotItems(i).Visible
= False
       End If
   Next i
   
End Sub
maverick502 - 25 Jan 2007 17:00 GMT
anything? any ideas?
 
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.