Intersection of named ranges (same ws) doesn't work.

Aronax

New Member
Joined
Aug 19, 2013
Messages
3
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:
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
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!
 
Last edited by a moderator:

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
I am surprised you are not getting errors earlier because I am accustomed to using the keyword Set to set r1 and r2.. but maybe that is a pivot table thing I am unaware of. The error you are pointing out at the bottom maybe because you are setting a range equal to values. Try r3 = Intersect(r1, r2) - (although I would expect you to have to use Set r3 = Intersect(r1, r2)).
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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