Reputation: 387
I have 3 ranges, "AA", "AB", and "AC".
The names of these ranges are on sheet 1 in column A.. so....
Cell A1 contains two letters "AA" Cell A2 contains AB Cell A3 contains AC
I need a formula to go down this list (A1:A3) and pull in the names of the ranges and paste them on another sheet.
I am able to achieve this with this code:
Range("AA").Copy Sheets(2).Range("B6")
Now I need a way to substitute the "AA" for a dynamic range such as Cell(c,r) so the formula can go down the list...because the names of these named ranges will change in other spreadsheets so I can't hardcode them.
Thank you for any suggestions!!!
Upvotes: 0
Views: 1239
Reputation: 2762
Using the name in cell A1,
ActiveWorkbook.Names([A1].Value).RefersToRange.Copy
will achieve the same copy as your snippet.
Upvotes: 1