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: 19
Default Toggle datafield in Pivottable

Hi all,

I don't know exactly what I have done, but the following code stop working.

All I want to do is simple; I have a Data validation cell, named
"data_field", that lets users choose one item from "Bid", "Offer" or "Mid".
Then, the choice is reflected to Pivottable data fields. Of course my data
source have three fields; Bid, Offer and Mid.

Here is the code:
---
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = Range("data_field").Address Then
Application.EnableEvents = False

With Me.PivotTables("PivotTable2")
.PivotFields(Target.Value).Orientation = xlDataField
.PivotFields(.DataFields(1).Name).Orientation = xlHidden

.RefreshTable
End With
Application.EnableEvents = True
End If
End Sub
---

Initially I have "Sum of Bid", "Sum of Offer" and "Sum of Bid" in Data
fields. Application.EnabledEvents = False/True prevents recursive calls to
Worksheet_Change itself.

What is a better way of achieving this? Sorry, I am VERY new to this
Pivottable programming...

I am using Excel 2002 SP-2 on Win2K Pro.

Thanks for your time.
---
Tetsuya Oguma, Singapore
 
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
Getpivotdata - able to reference to another cell all parameters but not the datafield Roger The Rabbit Excel Discussion (Misc queries) 6 September 3rd 06 03:10 PM
Show and Hide in Datafield Fullam Excel Discussion (Misc queries) 0 April 17th 06 12:26 PM
Datareport - Datafield not found Cady Steldyn Excel Programming 0 September 12th 04 05:14 AM
Finding Matching Pivot Datafield Todd Huttenstine Excel Programming 5 April 26th 04 09:26 PM
Macro to find last datafield Patrick[_6_] Excel Programming 2 November 30th 03 10:06 PM


All times are GMT +1. The time now is 01:54 AM.

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"