+ Reply to Thread
Results 1 to 2 of 2

Creating a Range from two specified Ranges

  1. #1
    Registered User
    Join Date
    05-15-2006
    Posts
    16

    Creating a Range from two specified Ranges

    Hi, I want to create a range where the begin and end cells are specified by two other Range variables. For example,

    Set r1 = ActiveSheet.Range("C5")
    Set r2 = ActiveSheet.Range("E8")

    How can I define r3 to contain the range "C5:E8" using these two?

    Thanks in advance.

  2. #2
    Gary Keramidas
    Guest

    Re: Creating a Range from two specified Ranges

    try this, but i wouldn't use r1 and r2, those are cell addresses

    Sub test()
    Dim rng1 As Range, rng2 As Range, rng3 As Range
    Set rng1 = ActiveSheet.Range("C5")
    Set rng2 = ActiveSheet.Range("E8")
    Set rng3 = Range(rng1, rng2)
    rng3.Select
    End Sub


    Gary


    --


    Gary


    "PeterWilliams" <PeterWilliams.280yom_1147992001.8847@excelforum-nospam.com>
    wrote in message
    news:PeterWilliams.280yom_1147992001.8847@excelforum-nospam.com...
    >
    > Hi, I want to create a range where the begin and end cells are specified
    > by two other Range variables. For example,
    >
    > Set r1 = ActiveSheet.Range("C5")
    > Set r2 = ActiveSheet.Range("E8")
    >
    > How can I define r3 to contain the range "C5:E8" using these two?
    >
    > Thanks in advance.
    >
    >
    > --
    > PeterWilliams
    > ------------------------------------------------------------------------
    > PeterWilliams's Profile:
    > http://www.excelforum.com/member.php...o&userid=34438
    > View this thread: http://www.excelforum.com/showthread...hreadid=543547
    >




+ 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