ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need function to raplace cell value by a range (https://www.excelbanter.com/excel-programming/390858-need-function-raplace-cell-value-range.html)

Excel ESG

Need function to raplace cell value by a range
 
In column A I have values(strings) wich I need to replace by ranges
e.g.
range1=("rng1.1","rng1.2","rng1.3")
range2=("rng2.1","rng2.2")
range3=("rng3.1","rng3.2","rng3.3","rng3.4")

range2
range1
range3
should result in
rng2.1
rng2.2
rng1.1
rng1.2
rng1.3
rng3.1
etc

Thank U very much in advance

Shared knowledge makes you smarter

[email protected]

Need function to raplace cell value by a range
 
Hi
It isn't obvious to me what you want.
regards
Paul

On Jun 7, 8:00 am, Excel ESG
wrote:
In column A I have values(strings) wich I need to replace by ranges
e.g.
range1=("rng1.1","rng1.2","rng1.3")
range2=("rng2.1","rng2.2")
range3=("rng3.1","rng3.2","rng3.3","rng3.4")

range2
range1
range3
should result in
rng2.1
rng2.2
rng1.1
rng1.2
rng1.3
rng3.1
etc

Thank U very much in advance

Shared knowledge makes you smarter




NickHK

Need function to raplace cell value by a range
 
If you mean that "rng1.1","rng1.2" etc are range names, then:
Dim BigRange As Range
Set BigRange = Union(Range("rng1.1"), Range("rng1.2"))

so if these names are held in A1, A2 etc
Dim BigRange As Range
Set BigRange = Union(Range(Range("A1").Value), Range(Range("A1").Value))

Also, I'm not sure if "." is completely safe in a Name. Maybe use "_" to
avoid any issues.

NickHK

"Excel ESG" wrote in message
...
In column A I have values(strings) wich I need to replace by ranges
e.g.
range1=("rng1.1","rng1.2","rng1.3")
range2=("rng2.1","rng2.2")
range3=("rng3.1","rng3.2","rng3.3","rng3.4")

range2
range1
range3
should result in
rng2.1
rng2.2
rng1.1
rng1.2
rng1.3
rng3.1
etc

Thank U very much in advance

Shared knowledge makes you smarter





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

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