VBA on Computer A, but not Computer B, C, D, or E

kameelyan

New Member
Joined
Sep 6, 2005
Messages
6
Ok, I'm having issue where I'm getting an error on one computer that is running a macro, but it's working on just about every other machine I've test it on. For the life of me I cannot figure out why this is occurring.

We are all utilizing Microsoft Excel 2007 for Windows.

The error is:
Run-time error '1004':
Unable to set the ShowDetail property of the PivotItem class

The code is as follows:
Code:
        For Each iDataField In iTable.DataFields
            For Each iMeasure In iTable.PivotFields("MEASURE").VisibleItems
                iTableST.PivotFields("MEASURE").PivotItems(iMeasure.Name).ShowDetail = True
                For Each iBrand In iTable.PivotFields("BRAND").VisibleItems
                    valueUP = iTableST.GetPivotData(curQuarter, "Brand", iBrand, "MEASURE", iMeasure, curQuarter + " ST", "UP").Value
                    valueDN = iTableST.GetPivotData(curQuarter, "Brand", iBrand, "MEASURE", iMeasure, curQuarter + " ST", "DN").Value
                    
                    For Each iPivotCell In iDataField.DataRange.Cells
                        If iPivotCell.PivotCell.ColumnItems.Item(1) = iBrand.Name Then
                            If iPivotCell.PivotCell.RowItems.Item(1) = iMeasure.Name Then
                                With iPivotCell.Interior
                                    .PatternColorIndex = xlAutomatic
                                    If valueUP > 0 Then
                                        .Pattern = xlSolid
                                        .Color = 5296274
                                    ElseIf valueDN > 0 Then
                                        .Pattern = xlSolid
                                        .Color = 255
                                    Else
                                        .Pattern = xlNone
                                    End If
                                End With
                                'Debug.Print iMeasure.Name + " - " + iBrand.Name + " - " + CStr(valueUP) + " - " + CStr(valueDN) + " - " + CStr(iPivotCell)
                            End If
                        End If
                    Next
                Next
                iTableST.PivotFields("MEASURE").PivotItems(iMeasure.Name).ShowDetail = False
            Next
        Next

The line throwing the error is:
Code:
iTableST.PivotFields("MEASURE").PivotItems(iMeasure.Name).ShowDetail = True

Again, it's work fine on every machine except one.

Furthermore, on the machine that has the issue, if we go directly to the pivot table, you can see the expand button is there, and it is clickable. I would expect that if this error were to occur in the VBA, it'd also occur when you try to directly do what the VBA code is trying to do.

Any help on this would be greatly appreciated!
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Forum statistics

Threads
1,224,612
Messages
6,179,890
Members
452,948
Latest member
Dupuhini

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