Set Value to a Named Range

detriez

Board Regular
Joined
Sep 13, 2011
Messages
193
Office Version
  1. 365
Platform
  1. Windows
Since I cannot use a formula as report criteria for a Pivot Table I'm trying to set the value to a named range

Dashboard!A1 is my named range = repBrand
I want to push the value of repBrand to the pivot table criteria in IT Detail!D1

Can someone tell me what I'm missing here?

TIA

Code:
Private Sub Testing_Click()


Dim rRange As Range
    On Error Resume Next
        Set rRange = ThisWorkbook.Names("repBrand").RefersTo
Sheets("IT Detail").Range("D1").Value = rRange.Value


End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Try:
Code:
Set rRange = ThisWorkbook.Range("repBrand")
</pre>
 
Upvote 0
Thanks for your reply JoeMo
This throws a Compile error: method or data member not found at .Range
 
Upvote 0
Thanks for your reply JoeMo
This throws a Compile error: method or data member not found at .Range
If repBrand is a named range with a global scope then try this:
Code:
set rRange = Range("repBrand")
 
Upvote 0

Forum statistics

Threads
1,203,677
Messages
6,056,688
Members
444,883
Latest member
garyarubin

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