Pivot tables - VBA

Emperor

Board Regular
Joined
Mar 25, 2010
Messages
225
Hi all,

I need some help with pivot tables.

I have Excel 2003 (at work) and I need to control a pivot table with VBA.

the columns are:
- Projects (projectnames, text)
- Date (date range)
- Employee (name)
- m2 (between 50 and 5000)

The rows are:
- Elementcodes

The filters created in a userform are:
140er8o.png


How could I control the different elements in VBA?

I am known with this:
Code:
With ActiveSheet.PivotTables("Draaitabel1").PivotFields("ELEMENTKD")
        .PivotItems("11").Visible = False
        .PivotItems("13").Visible = False
        .PivotItems("16").Visible = False
        .PivotItems("21").Visible = False
    End With
But how can I use this for a date range? and for m2 filtering?

Apart from this I have a issue with summing the data, I need a sum of every project. This is easy. But I also need a average over all projects. Can this be achieved?

Any help is welcome!

Mathijs
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,224,583
Messages
6,179,673
Members
452,937
Latest member
Bhg1984

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