ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Union (https://www.excelbanter.com/excel-programming/368139-union.html)

Arne Hegefors

Union
 
I try to make a union of two ranges but I cannot get it to work. I write the
code like this:

Set rngForbiddenSearchRange = Union(Range(searchRange1), Range(searchRange))

where I previously have defined:
Dim searchRange1 As Range
Set searchRange1 = Range(Cells(segment.Row, 1), Cells(segment.Row, 100))

and in another sub i have:

Dim searchRange As Range
Set searchRange = Range(Cells(secID.Row, 1), Cells(secID.Row, 100))

and I pass the searchRange along to the sub where I try to do the union.

Please I cannot see what is wrong here! I really would appreciate any help!
thanks alot!


Graham Whitehead

Union
 
try:

Set rngForbiddenSearchRange = Union(searchRange1,SearchRange)


"Arne Hegefors" wrote in message
...
I try to make a union of two ranges but I cannot get it to work. I write
the
code like this:

Set rngForbiddenSearchRange = Union(Range(searchRange1),
Range(searchRange))

where I previously have defined:
Dim searchRange1 As Range
Set searchRange1 = Range(Cells(segment.Row, 1), Cells(segment.Row, 100))

and in another sub i have:

Dim searchRange As Range
Set searchRange = Range(Cells(secID.Row, 1), Cells(secID.Row, 100))

and I pass the searchRange along to the sub where I try to do the union.

Please I cannot see what is wrong here! I really would appreciate any
help!
thanks alot!





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

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