ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   using variable in value1 of PivotFilters.Add (https://www.excelbanter.com/excel-programming/422014-using-variable-value1-pivotfilters-add.html)

aamerrasheed

using variable in value1 of PivotFilters.Add
 
Hi,

I am new to Macros and VBA. Trying to use a variable for value1 of
pivotfilters.add but it isn't working.
getting runtime error 1004.

Dim a As Variant
filtname = InputBox("Which data do you want", "Data input")

ActiveSheet.PivotTables("PivotTable1").PivotFields ("Release cause"). _
PivotFilters.Add Type:=xlCaptionContains, Value1:=filtname


Thanks.
Aamer


aamerrasheed via OfficeKB.com

using variable in value1 of PivotFilters.Add
 
Hi,
Can anybody help me out in using variable in Value1 of PivotFilters.Add.

Thanks.

aamerrasheed wrote:
Hi,

I am new to Macros and VBA. Trying to use a variable for value1 of
pivotfilters.add but it isn't working.
getting runtime error 1004.

Dim a As Variant
filtname = InputBox("Which data do you want", "Data input")

ActiveSheet.PivotTables("PivotTable1").PivotFields ("Release cause"). _
PivotFilters.Add Type:=xlCaptionContains, Value1:=filtname

Thanks.
Aamer


--
Message posted via http://www.officekb.com



All times are GMT +1. The time now is 01:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com