Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Joe Joe is offline
external usenet poster
 
Posts: 476
Default Macros and field names

I am extracting records, as part of a macro, from a list range on the
worksheet into a data named range. At times the source table will be
increased or decreased in size and when I run the macro I want it to resize
the extracted name range. How do I program this within the macro?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 703
Default Macros and field names

Hi

Maybe this will help you:

NameRange = Range("A1", Range("A1").End(xlDown)).Address
ActiveWorkbook.Names.Add Name:="MyRangeName", RefersTo:="=Sheet1!" &
NameRange

Regards,
Per


On 3 Nov., 02:07, Joe wrote:
I am extracting records, as part of a macro, from a list range on the
worksheet into a data named range. *At times the source table will be
increased or decreased in size and when I run the macro I want it to resize
the extracted name range. *How do I program this within the macro?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,344
Default Macros and field names

Hi,

Suppose that the data is extracted to A1:D200

Range("A1").CurrentRegion.Name = "Database"

This assumes there is no data that is touching your extract that is not part
of the range you want to name.

--
Thanks,
Shane Devenshire


"Joe" wrote:

I am extracting records, as part of a macro, from a list range on the
worksheet into a data named range. At times the source table will be
increased or decreased in size and when I run the macro I want it to resize
the extracted name range. How do I program this within the macro?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 206
Default Macros and field names

Perhaps it would be simpler to create a dynamic named range and let the
range adjust to the data size, so the code doesn't need to.

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

Mike F
"Joe" wrote in message
...
I am extracting records, as part of a macro, from a list range on the
worksheet into a data named range. At times the source table will be
increased or decreased in size and when I run the macro I want it to
resize
the extracted name range. How do I program this within the macro?



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
Pivot Table Field Names bamataylor Excel Discussion (Misc queries) 0 February 3rd 10 04:07 PM
Field Names Don't Show Bob Levin Excel Discussion (Misc queries) 4 August 21st 07 05:54 PM
Field Names Bob Levin Excel Discussion (Misc queries) 1 August 21st 07 03:25 PM
field names pjbur2005 via OfficeKB.com Excel Programming 0 January 12th 07 12:54 AM
Column Words to Field Names rciolkosz Excel Discussion (Misc queries) 1 May 25th 06 11:09 PM


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