I'm using Excel 2010. I want to adjust the Columns by using the contents of a given cell, perhaps just the active cell, so I can click on a cell, click a button, and have the Columns be filtered by the contents of the active cell.
So, for example, I have in the active cell the value "2100". I want to click a button and have the columns adjust the filter to "contains 2100".
I recorded a macro, and then tried to adjust the code but no workie:
If I type in "2100" instead of "aa", it works. But the variable for whatever reason throws it off. What have I done wrong?
Thanks for your help!
Thanks!!
Matt
So, for example, I have in the active cell the value "2100". I want to click a button and have the columns adjust the filter to "contains 2100".
I recorded a macro, and then tried to adjust the code but no workie:
Code:
aa = ActiveCell.Value
ActiveSheet.PivotTables("PivotTable1").PivotFields("Xmitter").ClearAllFilters
ActiveSheet.PivotTables("PivotTable1").PivotFields("Xmitter").PivotFilters.Add _
Type:=xlCaptionContains, Value1:=aa
If I type in "2100" instead of "aa", it works. But the variable for whatever reason throws it off. What have I done wrong?
Thanks for your help!
Thanks!!
Matt