+ Reply to Thread
Results 1 to 2 of 2

Union

  1. #1
    Arne Hegefors
    Guest

    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!


  2. #2
    Graham Whitehead
    Guest

    Re: Union

    try:

    Set rngForbiddenSearchRange = Union(searchRange1,SearchRange)


    "Arne Hegefors" <[email protected]> wrote in message
    news:[email protected]...
    >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!
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1