Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 89
Default named ranges get larger

I have a sheet with a named range. every month i add a row of data via a
macro. How can I set the named range to also get one row larger?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default named ranges get larger

have a look he

http://www.contextures.com/xlNames01.html#Dynamic
--
jb


"thomas donino" wrote:

I have a sheet with a named range. every month i add a row of data via a
macro. How can I set the named range to also get one row larger?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default named ranges get larger

This should do what you want (just change the two occurences of "MyRange" to
the actual name of your range)...

With Range("MyRange")
ActiveWorkbook.Names("MyRange").RefersTo = Replace(.Name, .Address, _
.Resize(.Rows.Count + 1).Address)
End With

--
Rick (MVP - Excel)


"thomas donino" wrote in message
...
I have a sheet with a named range. every month i add a row of data via a
macro. How can I set the named range to also get one row larger?


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default named ranges get larger

Or

with range("MyRange")
.resize(.rows.count+1).name = .Name.Name
end with

or

with range("MyRange")
.resize(.rows.count+1).name = "MyRange"
end with

If the name is local to the sheet (not a global name):

with worksheets("somesheetnamehere").range("MyRange")
.resize(.rows.count+1).name = "'" & .parent.name & "'!" & .Name.Name
end with

or
with worksheets("somesheetnamehere").range("MyRange")
.resize(.rows.count+1).name = "'" & .parent.name & "'!MyRange"
end with


Rick Rothstein wrote:

This should do what you want (just change the two occurences of "MyRange" to
the actual name of your range)...

With Range("MyRange")
ActiveWorkbook.Names("MyRange").RefersTo = Replace(.Name, .Address, _
.Resize(.Rows.Count + 1).Address)
End With

--
Rick (MVP - Excel)

"thomas donino" wrote in message
...
I have a sheet with a named range. every month i add a row of data via a
macro. How can I set the named range to also get one row larger?


--

Dave Peterson
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
Named ranges and pasting formulas with named references Dude3966 Excel Programming 2 October 8th 08 04:15 PM
INDEX formula returns #REF! error for ranges larger than two cells hmm Excel Worksheet Functions 3 February 18th 08 01:58 PM
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... christian_spaceman Excel Programming 3 December 24th 07 01:15 PM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Excel Programming 0 August 21st 06 03:51 PM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM


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