Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Named range in a sheet referred to from another sheet

(Using Excel 2000 under Windows 98)

I have created a 1-cell named range by selecting cell A1 on Sheet1 and then
typing the name "MyCell" (without the quotes) in the names Litsbox.
Thereafter, I have typed this code in the click event of a command button
located in another sheet (Sheet2):

Range(ThisWorkbook.Names("MyName")).Value = 100

When I click on the button I get error 1004. However, if the button is in
Sheet1 it works fine. So how do I have to MyCell in the first case?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Named range in a sheet referred to from another sheet

Try this

Application.Range("MyCell").Value = 100


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Lluis Escude" wrote in message
...
(Using Excel 2000 under Windows 98)

I have created a 1-cell named range by selecting cell A1 on Sheet1 and

then
typing the name "MyCell" (without the quotes) in the names Litsbox.
Thereafter, I have typed this code in the click event of a command button
located in another sheet (Sheet2):

Range(ThisWorkbook.Names("MyName")).Value = 100

When I click on the button I get error 1004. However, if the button is in
Sheet1 it works fine. So how do I have to MyCell in the first case?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Named range in a sheet referred to from another sheet

It works, thanks a lot.

Still I'd like to know what was wrong with my syntax: I asume my named range
was "global" for the entire workbook and not just for the sheet the specific
cell was in.

I have loads of code lines using

Range(ThisWorkbook.Names(...

so I wonder if I should change them -as well as new references yet to be
written- in accordance with your suggestion, and so avoid trouble in the
future.
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
Referencing a named range on another sheet Jan B Excel Worksheet Functions 5 April 4th 23 12:38 PM
Macro to insert named range in each sheet rbanks[_19_] Excel Programming 9 March 28th 06 03:32 PM
Recalculate Named Range After Sheet Changes soteman2005[_4_] Excel Programming 0 December 5th 05 02:10 PM
Loop thru named range of second sheet Bill Sturdevant[_2_] Excel Programming 3 July 29th 05 07:15 PM
Referencing Named Range in Other Sheet Dan E[_2_] Excel Programming 0 July 11th 03 04:22 PM


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