Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel 2003 Pivotchart Macro

Here's the line:

..Pivotfields(ls_measures(ln_measure, 0)).Orientation = xlHidden

With block is set to ActiveChart.PivotLayout.PivotTable.

ls_measures is a string array (0 to 5, 0 to 3). (x, 0) contains the
caption; (x, 1) contains the data field function; (x, 2) contains the
pivottable field name; (x, 3) contains the number format.

It fails on ls_measures(5, 0), a caclulated field (run time error '1004';
unable to set the orientation property of the pivotfield class). I'm current
on SPs and updates.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Excel 2003 Pivotchart Macro

I found the answer to my own question. I replaced it with the following:

If .PivotFields(ls_measures(ln_measure, 2)).IsCalculated Then
.PivotFields(ls_measures(ln_measure, 2)).Delete
.CalculatedFields.Add ls_measures(ln_measure, 2),
ls_measures(ln_measure, 4), True
Else
.PivotFields(ls_measures(ln_measure, 0)).Orientation = xlHidden
End If

If you have a data field based on a calculated field, you can check the
"IsCalculated" Property. If it's true, I delete the base calculation, which
removes the data field (without errors, I might add). I then created another
array element that has the calculation. Based on that information, I
recreate the calculation field. This spreadsheet is now *totally* automated.

"Sam Tyler" wrote:

Here's the line:

.Pivotfields(ls_measures(ln_measure, 0)).Orientation = xlHidden

With block is set to ActiveChart.PivotLayout.PivotTable.

ls_measures is a string array (0 to 5, 0 to 3). (x, 0) contains the
caption; (x, 1) contains the data field function; (x, 2) contains the
pivottable field name; (x, 3) contains the number format.

It fails on ls_measures(5, 0), a caclulated field (run time error '1004';
unable to set the orientation property of the pivotfield class). I'm current
on SPs and updates.

Reply
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
Macro to create pivotchart problems seed Excel Discussion (Misc queries) 0 April 23rd 10 08:23 PM
Duplicating PivotChart / Changing PivotChart data range BillG Charts and Charting in Excel 0 February 4th 09 08:56 PM
How to Print OLAP pivotchart in Frontpage 2003? Abobakr Nasr Excel Discussion (Misc queries) 0 February 23rd 06 11:48 AM
How to execute a macro when data in a pivotchart changes? TNandSEC Excel Programming 2 June 4th 04 08:01 PM
PivotChart formatting: macro for multiple unique charts Jocelyn[_3_] Excel Programming 0 January 20th 04 05:09 PM


All times are GMT +1. The time now is 02:28 PM.

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

About Us

"It's about Microsoft Excel"