View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default Auto size named range by .Net or VBA

If the named range includes an extra blank row beneath the last data row, it
will expand automatically if rows are inserted below the last data row.
Another option is to use a QueryTable, which has an option to range name the
resulting recordset. Hard to say which method is best suited since I don't
get your scenario exactly.


"Dale" wrote in message
...
I have a question about adding data to a named range.

I have an application that takes data from an Oracle database and writes
it
to a specified Excel file starting at a column and row specified in the
command line. I would like to change that so it writes to a named range.

Because there are several macros in the Excel template I am writing to,
those macros need to select ranges sized precicely for the data existing
in
the sheet and not, as they currently do, by selecting huge numbers of
columns
and cells just to cover all possibilities.

So, my question is, if I have a named range as a single cell as a starting
point, how would I add data to that row, then the next row, etc., etc., in
a
way that would cause the named range to automatically expand as I added
(inserted?) the data? Also, for a couple reports, I need other named
ranges
below the target range to automatically move down in the report as I
insert
new rows to the target named range - those other named ranges will become
the
target for other sets of data.

Thanks in advance for any help or suggestions.

Dale
--
Dale Preston
MCAD C#
MCSE, MCDBA