Named Range / use of Indirect?

jim may

Well-known Member
Joined
Jul 4, 2004
Messages
7,486
In cell A1 I have the text Testme

Testme is a Named Range
with RefersTo set to:
=Sheet1!$D$3:$D$5

In VBA - How do I

Range("A1").copy Range("D4").PasteSpecial xlPasteValues

And D4:D6 will show
123
456
789

This thing is beating me up -- Indirect is likely involved, but,,,
TIA
 
Does this float your boat?

Sub Macro1()
'
'
TestMe = Range("A1").Value
Range(TestMe).Select
Selection.Copy
Range("F3").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
 
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Thanks Yard;
The confusion I spread here in the last few minutes
DOESN'T Compare to the Confusion I've faced here
alone in the Past Hour.
Sorry, and again thanks for taking a shot at this!!
Jim
 
Upvote 0
Hi Jim

You could call the range directly like this:

Range("Testme")

and A1 houses the text Testme

so... Range("A1").Value will return Testme

therefore

Range(Range("A1").Value)

will work :)
 
Upvote 0
Yes Jon - Your Code "Caused the lights to COME BACK ON here"

Had lost sight that Range("A1").value would produce Testme
then using Range again (or wrapped around existing Range("A1").value)
produces Range("Testme").

Appreciate your input - have a great weekend with your fine looking child (boy/girl?)
Jim
 
Upvote 0

Forum statistics

Threads
1,214,585
Messages
6,120,399
Members
448,957
Latest member
Hat4Life

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