range name in macros

1inus

New Member
Joined
Jul 6, 2006
Messages
40
I have a list of range names in some cells a1:a10.
I tried to write a macro that referenced those cells in order to select the range name. I get a run time error when run, this is the code I have so far:

For Each rw In Range("name")
If rw = "" Then GoTo endmacro

Range(rw).Select

Next rw

endmacro:
I'll put in more code after it selects the range but I'm failing on the Range(rw).select
thanks
 

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Is this what you are looking for?
Code:
Dim RNG as range
Dim RngName as string
For each RNG in Range("A1:A10")
IF RNG.value <> "" Then
RngName = RNG.Value
Range(RngName).Select
End If
Next RNG
The way I understand it A1 would be something like "C1:C10" or "TitleCells" where TitleCells is a defined name pointing to for example B1:F1?

~Gold Fish
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,273
Members
448,559
Latest member
MrPJ_Harper

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