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

Hi:

I have a spreadsheet that contains a section I wish to import into Access. Because the
amount of data (specifically the number of rows) varies, I wish to give the range a name,
and I want to the name to refer to only those cells that contain data in column A. I know
how to SELECT the range, BUT I do not know how to make that selected range into a named
range, through programming.

If someone could help me with this I would much appreciate it.

Regards

John Baker
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Creating dymnamic named ranges

John,

Try a name with a RefersTo value of something like

=Sheet1!$A$1:OFFSET(Sheet1!$A$1,COUNTA(Sheet1!$A:$ A)-1,0)

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"John Baker" wrote in message
...
Hi:

I have a spreadsheet that contains a section I wish to import into Access.

Because the
amount of data (specifically the number of rows) varies, I wish to give

the range a name,
and I want to the name to refer to only those cells that contain data in

column A. I know
how to SELECT the range, BUT I do not know how to make that selected range

into a named
range, through programming.

If someone could help me with this I would much appreciate it.

Regards

John Baker



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Creating dymnamic named ranges


Hi,

By coincidence I posted a question invovling this earlier today.

One way would be to insert a named range in the excel sheet, called
DynaRange, say, and in the refers to box just add:

=OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet!!$A:$A)-1)

This assumes you have a header label in cell A1, and that you don't
have any empty rows within the main range.



Cheers,

Graham


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Creating dymnamic named ranges


oops, slight typo in the previous response

=OFFSET(Sheet1!$A$2,0,0,COUNTA(Sheet!$A:$A)-1)


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/

~~Now Available: Financial Statements.xls, a step by step guide to creating financial statements
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Creating dymnamic named ranges

Thanks

Can you give me the exat syntax -- im not to good on VBA.

Regards

John Baker

"Bob Phillips" wrote:

John,

Try a name with a RefersTo value of something like

=Sheet1!$A$1:OFFSET(Sheet1!$A$1,COUNTA(Sheet1!$A: $A)-1,0)




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Creating dymnamic named ranges

I believe there must be a command that loks like"

named.Range = ActiveCell()

I know thats not it, but is there something like that?


John Baker wrote:

Hi:

I have a spreadsheet that contains a section I wish to import into Access. Because the
amount of data (specifically the number of rows) varies, I wish to give the range a name,
and I want to the name to refer to only those cells that contain data in column A. I know
how to SELECT the range, BUT I do not know how to make that selected range into a named
range, through programming.

If someone could help me with this I would much appreciate it.

Regards

John Baker


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 98
Default Creating dymnamic named ranges

Hi:

After a lot of digging, I found what I needed was a code set that looked like this:

Range("a2").Select
Selection.End(xlDown).Select
IROW = ActiveCell.Row
ICOLUMN = ActiveCell.Column
Cells(IROW, ICOLUMN).Select
'name the range transferdata

Cells(IROW, ICOLUMN).Name = "TRANSFERDATA"

This could help others with the same problem.

Regards

John Baker

John Baker wrote:

Hi:

I have a spreadsheet that contains a section I wish to import into Access. Because the
amount of data (specifically the number of rows) varies, I wish to give the range a name,
and I want to the name to refer to only those cells that contain data in column A. I know
how to SELECT the range, BUT I do not know how to make that selected range into a named
range, through programming.

If someone could help me with this I would much appreciate it.

Regards

John Baker


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
Problem creating named ranges in a Macro! LABKHAND Excel Discussion (Misc queries) 2 January 8th 10 04:58 PM
Creating dynamic ranges which are named. U0107 Excel Worksheet Functions 1 January 5th 10 11:46 PM
Named Ranges Epinn Excel Worksheet Functions 23 October 16th 06 07:27 AM
Like 123, allow named ranges, and print named ranges WP Excel Discussion (Misc queries) 1 April 8th 05 06:07 PM
Creating Named Ranges in VBA Mark D'Agosta Excel Programming 4 October 4th 03 06:15 AM


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