Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Creating a defined name's Refersto range

On Tuesday, March 13, 2012 7:37:31 PM UTC-5, kittronald wrote:
I'm trying to create a defined name's Refersto range of
"Sheet1!$A$1:$A$5" using the variable below.

r = 5

Workbooks("Book1.xlsb").Names.Add Name:="Test",
RefersTo:=Sheets("Sheet1").Range("A1").Resize(r - 1, 0)

This doesn't work and gives a Run-time error '9': Subscript out of range
error.

What is the code to get the Refersto range properly setup ?


kittronald


Another way, assuming same file

r=5
sheets("sheet1").range("a1").resize(r-1).name="Test"




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
Modifying a Defined Name's Contents kittronald Excel Programming 10 October 5th 11 02:19 PM
How to Print Name's list and Names Range? Excel_Oz Excel Worksheet Functions 3 March 29th 07 02:03 AM
Deleting Range name's listed in the range address box. Satnam Patel Excel Discussion (Misc queries) 4 May 5th 05 01:42 PM
Wierd named range RefersTo value chris Excel Programming 1 May 21st 04 04:40 PM
Wierd named range RefersTo value Bob Phillips[_6_] Excel Programming 0 May 21st 04 04:32 PM


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

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

About Us

"It's about Microsoft Excel"