ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   extending excel named range with vba (https://www.excelbanter.com/excel-programming/322049-extending-excel-named-range-vba.html)

Hugo & Monique

extending excel named range with vba
 
Hi,

I am trying to resize a named range (extracted from a database) according to
the actual number of rows which varies each time I dump records from that
database.
Since I don't want to do this manually each time, I would like to automate
this task. Can someone give me a hint on how this can be done in VBA ?

Thank you !

Monique
Belgium



Bob Phillips[_6_]

extending excel named range with vba
 

Set rng = ActiveSheet.UsedRange

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Hugo & Monique" wrote in message
...
Hi,

I am trying to resize a named range (extracted from a database) according

to
the actual number of rows which varies each time I dump records from that
database.
Since I don't want to do this manually each time, I would like to automate
this task. Can someone give me a hint on how this can be done in VBA ?

Thank you !

Monique
Belgium





Ben

extending excel named range with vba
 
ActiveWorkbook.Names.Add Name:="hello", RefersToR1C1:="=Sheet1!R66C32:R67C40"

where "hello" is the name of the range
and Sheet1 is the nanme of the sheet.
this will overwrite any existing range so do not worry about having to
modify it

R66C32 = upper left bound of range. R67C40 = lower right bound
substitute rows and columns as needed
"Hugo & Monique" wrote:

Hi,

I am trying to resize a named range (extracted from a database) according to
the actual number of rows which varies each time I dump records from that
database.
Since I don't want to do this manually each time, I would like to automate
this task. Can someone give me a hint on how this can be done in VBA ?

Thank you !

Monique
Belgium





All times are GMT +1. The time now is 05:10 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com