Excel 2003 :: Referencing Multiple Items From Pivot Field In Macro?

Aug 8, 2012

I am trying to create a macro that will change all pivot fields with a certain name to the value I have the master pivot changed to. For example, I have 5 pivot tables, which each contain the field "Fruit". I want to change the 1st pivot table to "Apples", "Oranges", and "Pears" as active values, and then run the macro, making the other fruit fields also have these values. I can do it for single items, but when I need to do multiple items, I get an error message. I'm not sure how to write in VBA in order to do this.

View 5 Replies


ADVERTISEMENT

Excel 2003 :: Force All Pivot Field Items Selected

Jun 22, 2012

I have a pivot table which I want to force the all of the pivot table items to be selected for a particular pivot table field. One would think that this would be as easy as unlocking all cells on the sheet with the exception of this pivot field and then locking the worksheet. This doesn't work though as I am generating multiple pivot tables on the same workbook for the same range and I get this message: "this command cannot be performed while a protected sheet contains another PivotTable report based on the same data source...".

My thinking is that I can do something along the lines of this:

Private Sub Worksheet_PivotTableUpdate(ByVal Target As PivotTable)
Dim oPI As PivotItem
Application.ScreenUpdating = False
If Target.PivotFields("Item Sold").PivotItems.Count Target.PivotFields("Item Sold").VisibleItems.Count Then

[Code]..

This is failing right away though on the If Target.Pivot.... line.

View 1 Replies View Related

Excel 2003 :: Pivot Table With 1 Row And 1 Column Field

Dec 3, 2012

I have:

Excel 2003ABCD1StockDatePriceReturn2MSFT31-Dec-1027.91-6.97%3MSFT31-Dec-093054.32%4MSFT31-
Dec-0819.44-45.39%5MSFT31-Dec-0735.619.22%6MSFT29-Dec-0629.8614.19%7MSFT30-Dec-0526.15-2.13%8MSFT31-
Dec-0426.72-2.37%9MSFT31-Dec-0327.37111.84%10MSFT31-Dec-0212.92-21.98%11MSFT31-Dec-0116.5652.77%12MSFT29-

[Code] .......

and would like:

Excel 2003ABCD1Sum of ReturnStock2DateBAINTCMSFT331-Dec-970.83851.14150.5659431-Dec-98-0.33350.68793.2921531-
Dec-990.27041.77732.3668629-Dec-000.59270.4606-0.6286731-Dec-01-0.41240.04620.5277831-
Dec-02-0.1493-0.5049-0.2198931-Dec-030.27741.05841.11841031-Dec-040.2285-0.2702-0.02371130-

[Code] ...........

Code:
Sub codedPTable()
Dim pt As PivotTable
Dim strField As String
Dim WSD As Worksheet
Set WSD = Worksheets("Data")

[Code] ..........

Only prints this:

Excel 2003ABCDE1Sum of ReturnStock2BAINTCMSFTGrand Total3Total1.99894.69867.331214.0287Sheet2

If you have a more compact macro than what I tried to change above even better (the data is in the simplest testing format).

View 4 Replies View Related

Excel 2003 :: Can Index Through Pivot Table Page Field List?

Nov 1, 2011

I've created a pivot table and I'd like to index through each "value" in the page field and then copy the results to another sheet, one sheet per field returned.

I can't figure out if it's possible to index through the list though. Is it possible?

View 4 Replies View Related

Automating Pivot Table To Check Multiple Items And Place Them Into Values Field?

Jul 20, 2012

I am trying to automate creation of pivot table, where the first three fields will go into the RowLabel field, and the rest of them will go into the values as "Sum of ____".

Is it possible? Because I could do it one by one; however, those fields are different every time (there are different number of those fields, and their values are also different).

View 1 Replies View Related

Excel 2003 :: Changing Visible Property Of Pivot Items

Nov 2, 2012

For some reason, I cannot get why I keep getting an error saying that excel cannot set the property of a pivotitem's visibility. I use excel 2003.

Code:
For Each pi In ActiveSheet.PivotTables("PivotTable1").PivotFields("Group Code Description").PivotItems
check = pi.Name
If check = group Then
If pi.Visible = False Then
pi.Visible = True

[Code] .........

View 1 Replies View Related

Filter Pivot Table Field By Referencing Another Cell

Sep 26, 2012

I have a worksheet ("VillageReport") that contains several pivot tables. All tables are from the same data source and all pivot tables have "Location" as the first column field. I would like for the tables on this sheet to automatically be filtered when I select a village name from a drop down menu in a cell on this worksheet (C1). So, for example, when I select "Tarzana" in C1, the location field of all pivot tables on this sheet will show only Tarzana (all others are deselected).

a Macro for this? (I have already set up the drop down menu in C1). I have found some examples online but can't seem to adjust the code to fit my workbook. I am not very familiar with VBA.

View 9 Replies View Related

Check Pivot Page Field Items

Sep 15, 2006

I have an array set up with values I want to look in a Pivot Field for and then pull data back based on that selection. It works great until there is an item in my array that is not listed in the Pivot Field. Then it pulls the data from the last item again, which skews my results. So my questions is, how can I skip to the next item in an array if it is not listed in the Pivot Field? Here is the section of code

ActiveSheet.PivotTables("PivotTable36").PivotFields("Product").CurrentPage _
= arrProductVals(intProduct, 2)

View 9 Replies View Related

Select Pivot Field Items By Criteria

May 18, 2007

Need code that takes names of people from one excel sheet and selects the names in a pivot table field in another excel sheet. Basically I need to know the code that selects pivot items in a pivot field (say name of the pivot field is 'EmpName' and the pivot items are the names of the employees). As of now I check the name in one excel sheet then manually select the name from the 'Emp Name pivot field in the pivot table. There are many names and manually selkecting one by one is very time consuming hence I am trying to automate this.

View 5 Replies View Related

Excel 2003 :: How To Create Pivot Table With Multiple Columns Each Month

Apr 4, 2014

I am trying to create a Chart from a Pivot Table. I want the Chart to show my projects and present each months amounts side-by-side comparing (Plan, Actual, Forecast) data each month for the calendar year.

I am trying to figure out how to generate the pivot table showing multiple projects so that the data is grouped by month comparing (Plan, Actual, Forecast) data. Projects are listed down the Rows while months Jan-Dec are along the columns. Each month has 3 columns because the second row contains header for the data sets of Plan, Actual & Forecast. (see sample below) When I try to create a Pivot Table, It shows multiple month fields (Jan, Jan2, Jan3, Feb, Feb2, Feb3) instead of a single month.

{Using Excel 2003}

NameOwnerJan JanJanFebFebFeb
PlanActualsForecastPlanActualsForecast
Project 1Region 1 126.1 119.6 119.6
Project 2Region 2 18.0 0.9 0.9 8.2 8.2
Project 3Region 2 80.0 2.6 2.6
Project 4Region 3
Project 5Region 3 60.0
Project 6Region 4 55.8 55.8 55.8
Project 7Region 4 19.4

View 2 Replies View Related

List All Hidden Page Field Items Of All Pivot Tables In Workbook

Nov 20, 2009

I am trying to write a list of pivot table page filter pivot items to the Immediate window - but only hidden items. The code below should do the job where the active sheet is a pivot table.

However when I change the page filter pivot items being hidden, the pivot items returned by the macro don't change. It seems to assume that all pivot items are hidden when in fact it may be only one or two. It will work though for pivot row items (pvt.RowFields) and pivot column items (pvt.ColumnFields) where the user changes them.

Does the pf.HiddenItems collection work for RowFields and ColumnFields but not PageFields? If so, is there a pivot field object that reliably holds hidden pivot items residing in the page filters?

Sub ListHiddenPageFilterPivotItems()

Dim wb As Workbook
Set wb = ThisWorkbook
Dim ws As Worksheet
Set ws = wb.ActiveSheet
Dim pvt As PivotTable
Dim pf As PivotField
Dim pi As PivotItem

View 8 Replies View Related

Excel 2003 :: Referencing Cell As (MS Query) Value?

Jan 22, 2013

We have a query, that looks at an external data source (db2 i believe). It will pull all data under a certain product set, and as an additional Criteria we currently have Serial Number.

Now, if the value entered is the serial number, lets say '1234567' for example, it will happily pull all instances of that into the table.

However, what I would like is a cell where I can enter the serial number, and the query will look at the Criteria, the Value will reference a cell (where we can type any serial number), and it will then populate it! I thought that would be fairly intuitive even for a complete novice like myself - now I am likely to have nightmares about Function Errors!

What I have tried:

*Setting the value to a cell ref... ie instead of '1234567' i have set the value to =$a$1 and in that cell i have a serial number.

*Tried to create a parameter. So value of [Serial Number] I then get a prompt saying "Enter parameter Value (serial number) - Regardless of if i type a cell reference (ie =$a$1, or i input the actual serial that worked before when it was '1234567' I still get a function error!

I keep trying different permutations of things, but I am ill prepared.

View 1 Replies View Related

Sum Up Multiple Items For The Same Field Using Cell References In GETPIVOTDATA?

Jan 2, 2014

I want to sum up data for two periods (4&5) from a pivot table using GETPIVOTDATA formula. I've only been successful when I manually type the period values 4 and 5 as is shown below:

=IFERROR((SUM(GETPIVOTDATA("Amount",'Transaction Pivot'!$J$3,"Period",{4,5},"Project",$A7,"Category","T&M"))),0)

However, I cannot get the formula to work when I substitute cell references for the period values 4 and 5. Therefore, the following formula does not work:

=IFERROR((SUM(GETPIVOTDATA("Amount",'Transaction Pivot'!$J$3,"Period",{E5,E6},"Project",$A7,"Category","T&M"))),0) where E5 has 4 in the cell and E6 has 5.

View 3 Replies View Related

Excel 2003 :: Macro To Hide Multiple Sheets?

May 10, 2012

I wrote a macro to select multiple sheets by name and hide them, but I keep getting the following error message:

"Object variable or with block variable not set".

Below is the macro:

Sub HideSheets1A()
Dim ws As Worksheet
Application.DisplayAlerts = False
If ws.Name = "Variance Evaluation" Or "Investment" Or "Costs & Incentives" Or "Revenues Total" Then ws.Visible = False
End Sub

I use Excel 2003

View 5 Replies View Related

Multiple Menu Items Under One Heading 2003

Jun 23, 2009

I've got several add-ins that I'd like the end user to install and have accessible under one menu item ("Assessments") in Excel 2003. So far, the code below successfully adds the item, but it only shows the item of one add-in. How can I get it to show all the items under the "Assessments" category?

Private Sub Workbook_Activate()
Run "AddMenus"
End Sub

Private Sub Workbook_Deactivate()
Run "DeleteMenu"
End Sub

Sub AddMenus()
Dim cMenu1 As CommandBarControl
Dim cbMainMenuBar As CommandBar
Dim iHelpMenu As Integer
Dim cbcCutomMenu As CommandBarControl

View 9 Replies View Related

Excel 2003 :: Selecting Only Certain Items From One Sheet To Another?

Mar 26, 2012

Using Excel 2003

We have a spreadsheet set up showing a list of sales invoices, each invoice has the customer name and a customer reference assigned to it i.e B1, B2 etc

We want to set up another sheet that takes the sales invoice information but only picks up that which relates to a specific customer, i.e want a list of the invoices relating to B1

This will be done with a view to creating statements for each individual customer reference number which will just take info from these sheets B1,B2 etc

View 1 Replies View Related

Excel 2003 :: Unprotect And Protect Multiple Works Sheets With Macro?

Feb 25, 2008

I have an annual leave (vacation) work book with a summary page work sheet and separate work sheets for each month i.e. Jan, Feb, Mar.....to......Dec. In order to protect the formulas I have protected them by allowing only access to the input cells on each work sheet and the protect each work sheet.

When someone either joins or leaves the team I have to manually unprotect each sheet and protect again when I have completed the amendments to each of the 13 tabs.

macro code I would need to unprotect all the works sheets in one go (as I use the same password for all the sheets) and reset the passwords (protect) the sheets with more macro code.

I will be running the two macros from my own personal.xls file and ideally they would be fully automatic i.e. I would not need to input the passwords in to unlock or lock the work sheets as the password would be written in the code already

Excel version 2003

View 3 Replies View Related

Excel 2003 :: VBA To Add Worksheets Named For Items In Range?

Jan 17, 2012

I some code that reduces a long list of dates from one source of data (in its own worksheet) down to a unique list of dates (on another worksheet). I need to create a new worksheet for each date in the range (named for the date), and then allocate each line item for that date in the source data into its repsective worksheet.

I'm using Excel 2003.

View 3 Replies View Related

Excel 2003 :: Get Number Of Items Against Specific Department?

Sep 7, 2012

I'm trying to get the number of items against a specific department which are contained in a sheet called "data", the sheet is contained in the same workbook.

There are named ranges for
Department (text)
Date_From & Date_To (in the format dd/mm/yyyy)
Band (Numeric 1 to 3)
Items (Numeric)

Using the following formula I get an #NUM error (using Excel2003)

=SUMPRODUCT(--(Department=A7),--(Date_From>=$B$2),--(Date_To

View 9 Replies View Related

Excel 2003 :: Find Data From Huge Database Of Items Of Equipment

May 23, 2012

Macro to find data from a huge database of items of equipment and find certain ones relevant to an area. I am using Excel 2003.

I have a spreadsheet which has three tabs.

Tab one has a list of equipment with a Ref (Col A), ID (Col B), mile (Col C) and chain (Col D) start and a mile (Col E) and chain (Col F) finish.

There are about 25 different Refs and IDs, but all rows have different Mile and Chains.

The second tab is an identical template of the third tab which is where I want the results to go (see below)

The third tab is raw data which list thousands of items but I want the macro to find the items which are in the first tab using the ref, ID, mile and chain information.

View 3 Replies View Related

Excel 2010 :: Pivot Table - Value Field - Multiply

Apr 25, 2014

I have a Pivot table showing costs of several types of items.

The issue is, the cost of an item is not in U$, it is in amounts of the unit value (example: Unit value of an item (cell A1) = U$500, and Item Cost (cell B1) = 2, the total cost is U$1000).

So instead of showing just the Item Cost (U$500) in the pivot table, I need to show 500*2 (A1*B1) which would be U$1000.

Can this be done in Excel 2010?

I don't want to create a new column with that multiplication, because I'm doing a monthly cost for the items.

View 3 Replies View Related

Excel 2007 :: Pivot Table Calculated Field

Mar 19, 2009

I believe that I am finally getting the hang of pivot tables and VBA ... pretty nice. Now for my latest frustration - calculated fields.

I have a pivot table created which compares two years of data. The problem seems to be that this data is from the same data field (PINSAL) even though it shows in two columns (year 2007 and year 2008).

1 - I need to subtract the 2007 figure (column C) from the 2008 figure (column D) in a calculated field called DollarVariance

2 - I need to divide DollarVariance into the 2007 figure to create a calculated field called PercentVariance

This seems easy to do if I had two different variables used to create the 2007 and the 2008 data but it is the same datafield. Can I use column letter? Can I use the column name assigned by the pivot routine (12 - 2007 and 12 - 2008)?

View 9 Replies View Related

Excel 2007 :: Pivot Table - How To Display And Use A Field

Jan 26, 2012

I have a table of data which I am analysing in a Pivot Table. For the majority of the data, the Pivot works very well: however I have a small issue, but it subsequently means the Pivot is useless.

Within the table array that I am referring to, there is a column of data of "Days per employee for a given period". The rows of data within the table array relate to every absence entry per employee, but this final column of data always contains the same figure (although can differ from employee to employee).

When I put the data into the Pivot, I can summarise the absence(s) as a simple sum. However, this final column of data should not be summed, since it is already the sum figure.

This figure though needs to be part of the Pivot, since I need to report on the percentage of absence days per type over the given period. So, the simple representation of =absence day(s)/worked days does not work... well I cannot get it to work. Additionally I have tried features like % of, but nothing.

I am using excel 2007.

View 5 Replies View Related

List Values From Excel Pivot Table Field

May 13, 2003

I have a Pivot Table with pivot fields and data. I would like, through VBA, to get the list of values that can be chosen from a given pivot field.

For example, a list would be Product1 / Product2 / Product3 .... I would like to read that list and put it into a drop down list in a form.

GOAL: I have several Pivot tables on the same sheet with similar fields and I want through macro to allow the user to update them all with one click.

View 9 Replies View Related

Pivot Table - Macro To Add First Field

Apr 13, 2013

I've created a Pivot Table with 30+ fields. I've recorded the following macro to add the first field. I need modifying the code so that it looks for and adds every field automatically. It'd save a lot of time.

Code:
Sub PTAdd()
'
' PTAdd Macro
'
'
With ActiveSheet.PivotTables("PivotTable3").PivotFields("Assigned To")
.Orientation = xlRowField
.Position = 1
End With
End Sub

View 4 Replies View Related

VBA To Select Multiple Items In Pivot Table

Jun 21, 2012

I'm trying to write a macro to select the multiple sets of the same data for several PIVOT tables. I've tried Slicers but it seems that this takes up too much processing power and always times out.

My workaround is to do a macro that picks out the said data, however when i do the below, plus another 4-500 lines i get told that there are too many line continuations

Code:
ActiveSheet.PivotTables("PivotTable6").PivotFields( _
"[Postal District].[Postal District].[Postal District]").VisibleItemsList = _
Array("[Postal District].[Postal District].&[AB11]", _
"[Postal District].[Postal District].&[AB12]", _

[Code] ...

What I'm looking to do is express all the postcodes in one line or at least multiple post codes in one go, this is what I've tried:

Code:
"[Postal District].[Postal District].&[AB12].&[AB13]"
and
Code:
"[Postal District].[Postal District].&[AB12,AB13]"
But to no avail.

View 4 Replies View Related

Excel 2007 :: ERROR - Pivot Table Field Name Is Not Valid

Nov 3, 2012

Excel 2007

No empty rows
No empty cells
No calculations in cells

Field names look fine - no punctuation no merged cells

If I select one column - any single column I can generate a pivot table but not with multiple columns

View 4 Replies View Related

Excel 2007 :: Pivot Table Calculated Field With Reference

Nov 18, 2012

I have a set of sales data and need to create a run rate which is simply = Total Sales/Selling Day

Selling day changes most days.

I put the calculation into my pivot data but it's summing up, (instead on 12 I get 720) so I changed this to Average so I get the right figure in the Pivot but when I then use this field, it doesn't use the Average amount, it uses the summed figure.

So what I need is Total Sales/X

X = Cell Reference

View 2 Replies View Related

Macro To Add Data Field To Pivot Table

Jun 27, 2008

I've got a bunch of pivot tables with nothing in their data fields and I want to add two things to the data fields of each, but I keep getting this error as soon as I start my loop:

Run-time error ‘1004’: Unable to get the PivotFields property of the PivotTable class

Here's the code that is highlighted when the error comes up:

ActiveSheet.PivotTables("Master_" & Count).AddDataField _
ActiveSheet.PivotTables("Master_" & Count).PivotFields( Sheets("raw data"). Cells(1 + Count, 2)), _
("Sum of " & Sheets("raw data").Cells(1 + Count, 2)), xlSum

I recorded doing the first one by hand and it looks like this:

ActiveSheet.PivotTables("Master_1").AddDataField ActiveSheet.PivotTables( _
"Master_1").PivotFields("10/2 Spread"), "Sum of 10/2 Spread", xlSum

I don't understand why I'm getting the error because I added watches and my variables are all saying what I want them to say (Master_1, 10/2 Spread)...

View 3 Replies View Related

Pivot Table Field List - Choose Multiple Fields At Same Time

Nov 9, 2011

In the "Pivot Table Field List" I have the option to "Choose fields to add to report". I have a large number of fields that I want to choose and "Add to Values" - so it is tedious to select each item individually.My question: Is there any possible way select multiple fields at the same time? e.g.

a "select all" option, orhighlighting a range of the available fields (either by dragging or holding the shift key)I've looked / tried above with no luck.

Any Excel Add-Ins out there that might address this? I'm fearing not since my searches have come up empty.

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved