Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Range names -VBA

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Range names -VBA

What is wrong with the responses given yesterday?

--

HTH

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


"JOhnUK" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Range names -VBA

Sorry Bob, But I can't access yesterdays post, so I had
no idea that it was even answered
John
-----Original Message-----
What is wrong with the responses given yesterday?

--

HTH

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


"JOhnUK" wrote in

message
...
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



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Range names -VBA

John,

Check out Google

http://tinyurl.com/dqy8g

--

HTH

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


"JohnUK" wrote in message
...
Sorry Bob, But I can't access yesterdays post, so I had
no idea that it was even answered
John
-----Original Message-----
What is wrong with the responses given yesterday?

--

HTH

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


"JOhnUK" wrote in

message
...
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



.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
converting email address names in a range of cells to real names John Excel Worksheet Functions 1 May 19th 10 03:44 PM
How to Delete blanks between a range and populate only the names inthe given range Yuvraj Excel Discussion (Misc queries) 2 November 4th 09 08:32 PM
COPYING FORMULA CONTAINING NAMES/RELATIVE RANGE NAMES Bricol Excel Discussion (Misc queries) 0 July 8th 08 03:54 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
range names luvmath03 Excel Discussion (Misc queries) 8 May 19th 06 01:43 AM


All times are GMT +1. The time now is 09:05 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"