Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Create a Named Range in Excel with VBA

Hello Group:
I am attempting to create a named range in Excel by using a VBA macro. I
have a table of information where the number of rows is variable. I need to
create a hard coded range name by running a macro which will change as the
number of rows changes.

I attempted to record keystrokes, but am not getting the correct result.
Does anyone have any code they could share in this case?
thx
Bill
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Create a Named Range in Excel with VBA

Hi
see:
http://www.xldynamic.com/source/xld.Names.html

--
Regards
Frank Kabel
Frankfurt, Germany

"GoKingBee" schrieb im
Newsbeitrag ...
Hello Group:
I am attempting to create a named range in Excel by using a VBA

macro. I
have a table of information where the number of rows is variable. I

need to
create a hard coded range name by running a macro which will change

as the
number of rows changes.

I attempted to record keystrokes, but am not getting the correct

result.
Does anyone have any code they could share in this case?
thx
Bill


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Create a Named Range in Excel with VBA

If your table already has a range name (in my example "mytable"), then try
this piece of code

range("mytable").currentregion.name="mytable"

If the range doesn't exist yet, you need to add statements to set the active
cell to one within the range of interest, then continue with this code:

activecell.currentregion.name="mytable"

Substitue your named range as needed.

Rick Ward

"GoKingBee" wrote:

Hello Group:
I am attempting to create a named range in Excel by using a VBA macro. I
have a table of information where the number of rows is variable. I need to
create a hard coded range name by running a macro which will change as the
number of rows changes.

I attempted to record keystrokes, but am not getting the correct result.
Does anyone have any code they could share in this case?
thx
Bill

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
How to create a dynamic named range? Sunita Excel Discussion (Misc queries) 3 March 28th 08 07:47 PM
#value! error trying to create a simple dynamic named range Janis Excel Discussion (Misc queries) 1 August 3rd 07 07:20 PM
how do i create a named range excluding particular cells RobG2007 Excel Discussion (Misc queries) 4 July 25th 07 04:22 PM
Using a formula to create named range reference [email protected] Excel Worksheet Functions 4 June 29th 05 08:03 PM
Create named range Robert[_16_] Excel Programming 2 October 27th 03 11:57 PM


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