Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default How to pull a value out of a cell into a macro filter

I am not an experienced VBA guy. Mostly record and look with little tweaks. I
have a pivot table that provides data for a list of customers. I have text
boxes for each customer with assigned macros to filter on the customer name.
The reason for the buttoins vs. normal pivot table functions is that this
table is designed for inexperienced users who would otherwise not use the
information. This all works but is a little cumbersome. What I would like is
one button that pulls desired customer information form a CELL which could be
a dropdown list. This would also would make it much easier to add or subtract
customers because I would only have to adjust my list vs creating a button
and macro for each individual customer. Here is what each buttton performs:

Sub Cust_MinnPwr()
'
' Cust_MinnPwr

Sheets("By Train Summary").Visible = True
Sheets("By Train Summary").Select
ActiveSheet.PivotTables("Main Display").PivotFields("Customer"). _
ClearAllFilters
ActiveSheet.PivotTables("Main Display").PivotFields("Customer"). _
PivotFilters.Add Type:=xlCaptionEquals, Value1:="Minn Pwr"
Range("i17").Select
End Sub


Any assistance would be much appreciated.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 515
Default How to pull a value out of a cell into a macro filter

Take one of the existing macro's, rename it if you wish, and do the following
Create a variable called eg varCust
Insert a line with the following code:
varCust = InputBox("For which customer do you wish to view data?", _
"Enter customer name")
Now change your existing line
ActiveSheet.PivotTables("Main Display").PivotFields("Customer"). _
PivotFilters.Add Type:=xlCaptionEquals, Value1:="Minn Pwr" to read
ActiveSheet.PivotTables("Main Display").PivotFields("Customer"). _
PivotFilters.Add Type:=xlCaptionEquals, Value1:=varCust

--
Hth

Kassie Kasselman
Change xxx to hotmail


"looper" wrote:

I am not an experienced VBA guy. Mostly record and look with little tweaks. I
have a pivot table that provides data for a list of customers. I have text
boxes for each customer with assigned macros to filter on the customer name.
The reason for the buttoins vs. normal pivot table functions is that this
table is designed for inexperienced users who would otherwise not use the
information. This all works but is a little cumbersome. What I would like is
one button that pulls desired customer information form a CELL which could be
a dropdown list. This would also would make it much easier to add or subtract
customers because I would only have to adjust my list vs creating a button
and macro for each individual customer. Here is what each buttton performs:

Sub Cust_MinnPwr()
'
' Cust_MinnPwr

Sheets("By Train Summary").Visible = True
Sheets("By Train Summary").Select
ActiveSheet.PivotTables("Main Display").PivotFields("Customer"). _
ClearAllFilters
ActiveSheet.PivotTables("Main Display").PivotFields("Customer"). _
PivotFilters.Add Type:=xlCaptionEquals, Value1:="Minn Pwr"
Range("i17").Select
End Sub


Any assistance would be much appreciated.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Pull-down list for chart filter? Dallman Ross Excel Discussion (Misc queries) 1 September 4th 07 02:45 PM
pivot table pull down filter Sanj Excel Worksheet Functions 1 September 8th 06 02:32 AM
entry not removed in pivot table pull down filter EL in Melb. Excel Worksheet Functions 1 September 4th 06 09:32 PM
AutoFilter Pull Criteria from one sheet and custom filter on other dtg_denver Excel Programming 8 August 20th 05 10:47 PM
Pull data - Advance Filter lil''bibbib Excel Worksheet Functions 1 June 29th 05 03:08 AM


All times are GMT +1. The time now is 08:30 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"