ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Marco command to name a range? (https://www.excelbanter.com/excel-programming/386834-marco-command-name-range.html)

[email protected]

Marco command to name a range?
 
I'm trying to create a macro command that will create a range name for
a range that is set by the end - right - end - down process (since the
dimensions will change each time it's run) I'm sure it's easy, but
I'm just a rookie at this.


Susan

Marco command to name a range?
 
if you turn on the macro recorder
do what you want to do
and then turn it off
and then look at the code it produced, it will give you some ideas of
how to set the range.
then you can name the range.
hth
susan


On Apr 4, 7:52 am, wrote:
I'm trying to create a macro command that will create a range name for
a range that is set by the end - right - end - down process (since the
dimensions will change each time it's run) I'm sure it's easy, but
I'm just a rookie at this.




Bob Phillips

Marco command to name a range?
 
Dim rng As Range
Set rng = Range(ActiveCell, ActiveCell.End(xlToRight))
Set rng = Range(rng, rng.End(xlDown))
rng.Name = "myName"


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

wrote in message
ups.com...
I'm trying to create a macro command that will create a range name for
a range that is set by the end - right - end - down process (since the
dimensions will change each time it's run) I'm sure it's easy, but
I'm just a rookie at this.





All times are GMT +1. The time now is 12:44 PM.

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