ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range Name and VBA (https://www.excelbanter.com/excel-programming/355347-range-name-vba.html)

Richard m

Range Name and VBA
 

I am using several tables with one of them called Database. When I add
items to the other ones how do I create or redefine the range for a
range name using VBA?


--
Richard m


------------------------------------------------------------------------
Richard m's Profile: http://www.excelforum.com/member.php...fo&userid=2601
View this thread: http://www.excelforum.com/showthread...hreadid=519848


Bob Phillips[_6_]

Range Name and VBA
 
Here is one way

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


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Richard m" wrote
in message ...

I am using several tables with one of them called Database. When I add
items to the other ones how do I create or redefine the range for a
range name using VBA?


--
Richard m


------------------------------------------------------------------------
Richard m's Profile:

http://www.excelforum.com/member.php...fo&userid=2601
View this thread: http://www.excelforum.com/showthread...hreadid=519848




Richard m

Range Name and VBA
 

Bob. I do not understand now that will help redifine the range. More o
what I am doing:

I am using code to open the form to add data. When the form closes,
want to redifine the range to inlcude the new data (just like using th
range name database). I am using two to three forms to enter data int
different tables

--
Richard

-----------------------------------------------------------------------
Richard m's Profile: http://www.excelforum.com/member.php...nfo&userid=260
View this thread: http://www.excelforum.com/showthread.php?threadid=51984


Bob Phillips[_6_]

Range Name and VBA
 
I can't say that I understand what you mean by '... the range name database
....', but currentregion picks up a range around a stated cell, so if you
always state its start cell, currentregion will go forward to the first
empty row and column, thereby picking up all the data.

If that isn't what you want, I think you need to be clearer on your data
etc.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Richard m" wrote
in message ...

Bob. I do not understand now that will help redifine the range. More on
what I am doing:

I am using code to open the form to add data. When the form closes, I
want to redifine the range to inlcude the new data (just like using the
range name database). I am using two to three forms to enter data into
different tables.


--
Richard m


------------------------------------------------------------------------
Richard m's Profile:

http://www.excelforum.com/member.php...fo&userid=2601
View this thread: http://www.excelforum.com/showthread...hreadid=519848




Richard m

Range Name and VBA
 

Yes Bob, that is want I want to do. I can then delete the old and
rename it. Thanks a lot.


--
Richard m


------------------------------------------------------------------------
Richard m's Profile: http://www.excelforum.com/member.php...fo&userid=2601
View this thread: http://www.excelforum.com/showthread...hreadid=519848



All times are GMT +1. The time now is 09:41 AM.

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