Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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.


--
PeterWilliams
------------------------------------------------------------------------
PeterWilliams's Profile: http://www.excelforum.com/member.php...o&userid=34438
View this thread: http://www.excelforum.com/showthread...hreadid=543547

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default 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"
wrote in message
news:PeterWilliams.280yom_1147992001.8847@excelfor um-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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Ranges Easily Guilherme Loretti Excel Discussion (Misc queries) 2 September 28th 07 01:11 PM
Creating cell ranges Neal Excel Programming 0 May 11th 06 11:12 PM
Creating Non-Contiguous Cell Ranges [email protected] Excel Programming 0 September 6th 04 02:53 AM
Creating Ranges Rich Cooper Excel Programming 6 June 3rd 04 07:34 PM
Creating Named Ranges in VBA Mark D'Agosta Excel Programming 4 October 4th 03 06:15 AM


All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"