Hello!
I'm trying to make a range selection in a pivot table as per the snapshot below:
http://imageshack.us/a/img27/4411/ixaj.jpg
The values I am trying to select are the ones that are both red and italic. (Mobile, Other Fix, Fix) from CBU_NA. I've searched and found a way to select both the rows for CBU_NA category and also the column categ2. However when I try to make an intersection out of the 2 ranges I receive an error. I'm using Excel 2010 on windows 7.
Below the code I am using:
Any suggestion is welcomed as I've been banging my head with this one for a few hours and haven't found a solution to it yet. It seems simple but I'm surely doing something wrong.
Thanks in advance for your help!
I'm trying to make a range selection in a pivot table as per the snapshot below:
http://imageshack.us/a/img27/4411/ixaj.jpg
The values I am trying to select are the ones that are both red and italic. (Mobile, Other Fix, Fix) from CBU_NA. I've searched and found a way to select both the rows for CBU_NA category and also the column categ2. However when I try to make an intersection out of the 2 ranges I receive an error. I'm using Excel 2010 on windows 7.
Below the code I am using:
Code:
Sub FCST()
Dim r1, r2, r3 As Range
r1 = pt.PivotFields("categ2").DataRange.Select
Selection.Font.Italic = True
r2 = pt.PivotFields("categ1").PivotItems("CBU_NA").DataRange.EntireRow.Select
With Selection.Font
.Color = -36345961
.TintAndShade = 0
End With
' error received here where r3 gets assigned. (error 424 - object required)
r3 = Intersect(r1, r2).Value
End Sub
Thanks in advance for your help!
Last edited by a moderator: