Error 1004 - Application defined or object defined error for pvFld.PivotFilters.Add2 xlSpecificDate, , strFilter

Saab95

New Member
Joined
Mar 26, 2021
Messages
46
Office Version
  1. 365
Platform
  1. Windows
Hi there,

I seek for your help again.

I have 2 excels where I have the same VBA, for one no issue, for the second one I get a 1004 error.

1718897826550.png


in here

1718897911480.png


Any idea ?

Thank you
 

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
What happens if you add this line before your Add2 line(s) ?
VBA Code:
pvFld.ClearAllFilters
 
Upvote 0
Can you start with showing us what the pivot table looks like and also what is in Main B3 (have the cursor in B3 and include the formula bar in what you show).
 
Upvote 0
Can you start with showing us what the pivot table looks like and also what is in Main B3 (have the cursor in B3 and include the formula bar in what you show).
VBA doesn't wotk because the field I want to update is in the "Filters" section of the pivot field.

If I move it to the "Rows" section then VBA works. But this is not what I want.

Anyway to update it with VBA even if is in the "Filters" section ??

1719494547697.png
 
Upvote 0
VBA doesn't wotk because the field I want to update is in the "Filters" section of the pivot field.
That's why it is always useful to give us some visibility of your data.

Try this:
VBA Code:
pvFld.ClearAllFilters
pvFld.CurrentPage = CDate(strFilter)
 
Upvote 1
Solution

Forum statistics

Threads
1,224,818
Messages
6,181,150
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top