Range names -VBA

J

JOhnUK

Hi, I need a short code that pick up Range names from a
given number in a cell, and paste elsewhere. The code
below works, but I have in the region of a thousand named
ranges, and as you can imagine, if I kept to the way the
code below is written, it would be extremely long, and
time consuming.

If ActiveCell = "4126" Then
Application.Goto Reference:="A_4126"
Selection.Copy
Sheets("Main Page").Select
Range("B10").Select
ActiveSheet.Paste
Application.Goto Reference:="B_4126"
Selection.Copy
Sheets("Main Page").Select
Range("B29").Select
ActiveSheet.Paste
Range("A1").Select
End If
If ActiveCell = "4128" Then
Application.Goto Reference:="A_4128"
Selection.Copy
Sheets("Main Page").Select
Range("B10").Select
ActiveSheet.Paste
Application.Goto Reference:="B_4128"
Selection.Copy
Sheets("Main Page").Select
Range("B29").Select
ActiveSheet.Paste
Range("A1").Select
End If

And so on, and so on.
Any help greatly appreciated
John
 
B

Bob Phillips

What is wrong with the responses given yesterday?

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
J

JohnUK

Sorry Bob, But I can't access yesterdays post, so I had
no idea that it was even answered
John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top