ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   naming multiple ranges (https://www.excelbanter.com/excel-programming/416549-naming-multiple-ranges.html)

ranswrt

naming multiple ranges
 
I need to name mulitple ranges of cells that aren't connected. I tried:

Set rng1 = Range(xcell.Offset(2, 2), xcell.Offset(11, 2))
Set rng2 = Range(xcell.Offset(14, 2), xcell.Offset(59, 2))
Set rng3 = Range(xcell.Offset(62, 2), xcell.Offset(70, 2))
Set rng = Range(rng1, rng2, rng3)
rng.name = "alsestrng"

The set rng code doesn't work. How do I need to do this?
Thanks

Barb Reinhardt

naming multiple ranges
 
Have you tried

Set rng1 = Union(xcell.Offset(2, 2), xcell.Offset(11, 2))


--
HTH,
Barb Reinhardt




"ranswrt" wrote:

I need to name mulitple ranges of cells that aren't connected. I tried:

Set rng1 = Range(xcell.Offset(2, 2), xcell.Offset(11, 2))
Set rng2 = Range(xcell.Offset(14, 2), xcell.Offset(59, 2))
Set rng3 = Range(xcell.Offset(62, 2), xcell.Offset(70, 2))
Set rng = Range(rng1, rng2, rng3)
rng.name = "alsestrng"

The set rng code doesn't work. How do I need to do this?
Thanks


Peter T

naming multiple ranges
 
Set rng = Union(rng1, rng2, rng3)
rng.Name = "alsestrng"

Regards,
Peter T

"ranswrt" wrote in message
...
I need to name mulitple ranges of cells that aren't connected. I tried:

Set rng1 = Range(xcell.Offset(2, 2), xcell.Offset(11, 2))
Set rng2 = Range(xcell.Offset(14, 2), xcell.Offset(59, 2))
Set rng3 = Range(xcell.Offset(62, 2), xcell.Offset(70, 2))
Set rng = Range(rng1, rng2, rng3)
rng.name = "alsestrng"

The set rng code doesn't work. How do I need to do this?
Thanks




ranswrt

naming multiple ranges
 
Thank You

"Peter T" wrote:

Set rng = Union(rng1, rng2, rng3)
rng.Name = "alsestrng"

Regards,
Peter T

"ranswrt" wrote in message
...
I need to name mulitple ranges of cells that aren't connected. I tried:

Set rng1 = Range(xcell.Offset(2, 2), xcell.Offset(11, 2))
Set rng2 = Range(xcell.Offset(14, 2), xcell.Offset(59, 2))
Set rng3 = Range(xcell.Offset(62, 2), xcell.Offset(70, 2))
Set rng = Range(rng1, rng2, rng3)
rng.name = "alsestrng"

The set rng code doesn't work. How do I need to do this?
Thanks






All times are GMT +1. The time now is 03:06 PM.

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