Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Selecting a named range, the name of the named range is in a cell

What i want to do is the following :

I have a cell which i have named "ExtraRisk".
This cell contains text : example "Electricity", which is also the name of
a range.
Now i want to select this named range "Electricity" & copy the range

How do i do this.

What i have so far is :


Sub Risicos_toevoegen()

.....
Sheets("MASTER").Select

'I'm stuck here....
Application.Goto Reference:="ExtraRisk" 'I do not want to copy the named
range "ExtraRisk", but i want to copy the named range where the value of the
cell "ExtraRisk" refers to (this value is the name of a named range)
.....


Selection.Copy
.....

End Sub

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Selecting a named range, the name of the named range is in a cell

this may or may not be what you want:

Sub test()
Dim ws As Worksheet
Set ws = Worksheets("Master")
Dim rangeToSelect As String
rangeToSelect = ws.Range("extraRisk").Value
ws.Range(rangeToSelect).Select
End Sub

--


Gary Keramidas
Excel 2003


"Luc" wrote in message
...
What i want to do is the following :

I have a cell which i have named "ExtraRisk".
This cell contains text : example "Electricity", which is also the name of a
range.
Now i want to select this named range "Electricity" & copy the range

How do i do this.

What i have so far is :


Sub Risicos_toevoegen()

....
Sheets("MASTER").Select

'I'm stuck here....
Application.Goto Reference:="ExtraRisk" 'I do not want to copy the named
range "ExtraRisk", but i want to copy the named range where the value of the
cell "ExtraRisk" refers to (this value is the name of a named range)
....


Selection.Copy
....

End Sub


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Selecting a named range, the name of the named range is in a cell

If I understand you correctly, I think you want this...

Range(Range("ExtraRisk")).Copy

--
Rick (MVP - Excel)


"Luc" wrote in message
...
What i want to do is the following :

I have a cell which i have named "ExtraRisk".
This cell contains text : example "Electricity", which is also the name
of a range.
Now i want to select this named range "Electricity" & copy the range

How do i do this.

What i have so far is :


Sub Risicos_toevoegen()

....
Sheets("MASTER").Select

'I'm stuck here....
Application.Goto Reference:="ExtraRisk" 'I do not want to copy the
named range "ExtraRisk", but i want to copy the named range where the
value of the cell "ExtraRisk" refers to (this value is the name of a named
range)
....


Selection.Copy
....

End Sub


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Selecting a named range, the name of the named range is in a cell

Thanxxxxx

Luc

"Gary Keramidas" <GKeramidasAtMSN.com schreef in bericht
...
this may or may not be what you want:

Sub test()
Dim ws As Worksheet
Set ws = Worksheets("Master")
Dim rangeToSelect As String
rangeToSelect = ws.Range("extraRisk").Value
ws.Range(rangeToSelect).Select
End Sub

--


Gary Keramidas
Excel 2003


"Luc" wrote in message
...
What i want to do is the following :

I have a cell which i have named "ExtraRisk".
This cell contains text : example "Electricity", which is also the name
of a range.
Now i want to select this named range "Electricity" & copy the range

How do i do this.

What i have so far is :


Sub Risicos_toevoegen()

....
Sheets("MASTER").Select

'I'm stuck here....
Application.Goto Reference:="ExtraRisk" 'I do not want to copy the
named range "ExtraRisk", but i want to copy the named range where the
value of the cell "ExtraRisk" refers to (this value is the name of a
named range)
....


Selection.Copy
....

End Sub


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 135
Default Selecting a named range, the name of the named range is in a cell

Hi,

you mean this : Range(Range("ExtraRisk").address).Copy



| If I understand you correctly, I think you want this...

| Range(Range("ExtraRisk")).Copy

"


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default Selecting a named range, the name of the named range is in a cell

Nope, that is not what I meant. The OP said this...

1) I have a cell which i have named "ExtraRisk".

2) This cell contains text : example "Electricity", which is
also the name of a range.

3) Now i want to select this named range "Electricity" &
copy the range

Numbers 1 and 2 tell me that the contents of Range("ExtraRisk") is the word
Electricity and that Electricity is a named range. Number 3 says the OP
wants to copy Range("Electricity"). Since Range("ExtraRisk") contains the
word "Electricity", we can do a direct substitution, putting
Range("ExtraRisk") in place of the word "Electricity"; hence
Range(Range("ExtraRisk")) points to whatever the named range "Electricity"
points to; so, according to Number 3, we want to copy that...

Range(Range("ExtraRisk")).Copy

I guess the only thing this expression can be faulted for is relying on the
default value of the Range object; perhaps this would have been more to your
liking...

Range(Range("ExtraRisk").Value).Copy

--
Rick (MVP - Excel)


"michdenis" wrote in message
...
Hi,

you mean this : Range(Range("ExtraRisk").address).Copy



| If I understand you correctly, I think you want this...

| Range(Range("ExtraRisk")).Copy

"


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
Selecting more than 1 named range Diddy Excel Programming 2 February 17th 09 01:04 PM
selecting a named range based on a cell value WimR Excel Programming 1 August 2nd 07 09:07 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
Selecting and deleting named range based on cell value Rich Kniatt[_5_] Excel Programming 1 April 6th 06 08:04 PM
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM


All times are GMT +1. The time now is 11:04 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"