Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Named range questions

Hi all

I am a bit ocnfused with Names property. Please answer the following short questions
1. When to use local names and global names? I understand that If the same name is used for both locally and globally local name only exists
2. I have a named range "test" on Sheet1, with its 'referto' of "=Sheet1!$A$1:$A$5", that I can see in Insert|Name|Define... from Menu Bar. Then, in standard module (not behind sheet or class module) I have the following code to select the range
Range("test").Selec

This give me an error of Run-tim error '1004': Select method of Range failed. I really want to know why!!! How can I select the range (or manipulate cells on the same sheet, to my point) if activesheet is not the sheet that has that range

I am using Excel 2000 SR-1
--
Tetsuya, Sydney, Australia
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Named range questions

You can't use select on an inactive sheet. Just set a range object to the value then u can manipulate it

Set MyRng = Range("test"

----- Tetsuya Oguma wrote: ----

Hi all

I am a bit ocnfused with Names property. Please answer the following short questions
1. When to use local names and global names? I understand that If the same name is used for both locally and globally local name only exists
2. I have a named range "test" on Sheet1, with its 'referto' of "=Sheet1!$A$1:$A$5", that I can see in Insert|Name|Define... from Menu Bar. Then, in standard module (not behind sheet or class module) I have the following code to select the range
Range("test").Selec

This give me an error of Run-tim error '1004': Select method of Range failed. I really want to know why!!! How can I select the range (or manipulate cells on the same sheet, to my point) if activesheet is not the sheet that has that range

I am using Excel 2000 SR-1
--
Tetsuya, Sydney, Australia
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Named range questions

You can't select something if the sheet isn't active. Either activate
sheet1 first or use Application.Goto


You use local names when it is appropriate to your purpose.

You can have one global name and more than one local name with the same base
name. The local name takes precedence or masks the global name when
referenced on the sheet where it is local - similar to local variables and
global variables.

--
Regards,
Tom Ogilvy


"Tetsuya Oguma" wrote in message
...
Hi all,

I am a bit ocnfused with Names property. Please answer the following short

questions.
1. When to use local names and global names? I understand that If the same

name is used for both locally and globally local name only exists.
2. I have a named range "test" on Sheet1, with its 'referto' of

"=Sheet1!$A$1:$A$5", that I can see in Insert|Name|Define... from Menu Bar.
Then, in standard module (not behind sheet or class module) I have the
following code to select the range:
Range("test").Select

This give me an error of Run-tim error '1004': Select method of Range

failed. I really want to know why!!! How can I select the range (or
manipulate cells on the same sheet, to my point) if activesheet is not the
sheet that has that range?

I am using Excel 2000 SR-1.
---
Tetsuya, Sydney, Australia



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 244
Default Named range questions

You also need to fully qualify the name Range with the sheet objec
Set MyRng = Sheets("Sheet1").Range("test"

----- Tetsuya Oguma wrote: ----

Hi all

I am a bit ocnfused with Names property. Please answer the following short questions
1. When to use local names and global names? I understand that If the same name is used for both locally and globally local name only exists
2. I have a named range "test" on Sheet1, with its 'referto' of "=Sheet1!$A$1:$A$5", that I can see in Insert|Name|Define... from Menu Bar. Then, in standard module (not behind sheet or class module) I have the following code to select the range
Range("test").Selec

This give me an error of Run-tim error '1004': Select method of Range failed. I really want to know why!!! How can I select the range (or manipulate cells on the same sheet, to my point) if activesheet is not the sheet that has that range

I am using Excel 2000 SR-1
--
Tetsuya, Sydney, Australia
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Named range questions

Not in a general module if it is a workbook level name.

--
Regards,
Tom Ogilvy



"chris" wrote in message
...
You also need to fully qualify the name Range with the sheet object
Set MyRng = Sheets("Sheet1").Range("test")

----- Tetsuya Oguma wrote: -----

Hi all,

I am a bit ocnfused with Names property. Please answer the following

short questions.
1. When to use local names and global names? I understand that If the

same name is used for both locally and globally local name only exists.
2. I have a named range "test" on Sheet1, with its 'referto' of

"=Sheet1!$A$1:$A$5", that I can see in Insert|Name|Define... from Menu Bar.
Then, in standard module (not behind sheet or class module) I have the
following code to select the range:
Range("test").Select

This give me an error of Run-tim error '1004': Select method of Range

failed. I really want to know why!!! How can I select the range (or
manipulate cells on the same sheet, to my point) if activesheet is not the
sheet that has that range?

I am using Excel 2000 SR-1.
---
Tetsuya, Sydney, Australia



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
Multiple Named Range questions Carole O Excel Discussion (Misc queries) 3 July 3rd 07 12:12 PM
automatic range - named range give me circular reference... George Thorogood Excel Discussion (Misc queries) 0 February 22nd 07 07:53 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 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
Named range questions Tetsuya Oguma[_3_] Excel Programming 0 May 31st 04 12:16 AM


All times are GMT +1. The time now is 02:21 AM.

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"