LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Pivot tables - can change row/col vars but can't get rid of existing vars

Hi - I am trying to create an xl report based on pivot tables where
the user selects variables from a drop down control and these are
picked up by mode vba code and changes the pivot.

My problem is that while the code essentially works, the previously
chosen vars remain in the pivot!

The code adds vars to the pivot rather than replacing them!

I use the following code that can change the vars in a pivot table.

Sub AllWorkbookPivots()
Dim pt As PivotTable
Dim ws As Worksheet
Dim ptcache As PivotCache
Dim mrow, mcol As Variant


mrow = Sheets("Admin").Range("F3").Value
mcol = Sheets("Admin").Range("F5").Value

Set pt = Sheets("Sheet1").PivotTables(1)

With Sheets("Sheet1").PivotTables(1)
.PivotFields(mrow).Orientation = xlRowField
.PivotFields(mcol).Orientation = xlColumnField
.PivotFields("count").Orientation = xlDataField
End With

End Sub

Any ideas?

Thanks

Andrew

 
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
Scope, Public Vars, Referenced workbooks Neal Zimm Excel Programming 5 October 10th 06 10:55 PM
Different Behaviour of Public Object Vars in Worksheets vs. Add-In Etienne Excel Programming 0 January 4th 06 02:13 PM
functions & range vars [email protected] Excel Programming 2 July 15th 05 07:26 PM
Worksheet wide vars DoctorG Excel Programming 10 July 1st 05 04:26 PM
Global vars Nath Excel Programming 1 July 13th 04 04:20 PM


All times are GMT +1. The time now is 10:37 PM.

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

About Us

"It's about Microsoft Excel"