Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I want to set a range variable with the address of
variable already set in another workbook. The problem is if the address length is more than 256 (approx 17 to 25 areas). The following seems to work, but the Loop & Union method is slow with a very large number of areas. Sub CopyRngVar() Dim Rng1 As Range 'in active WB Dim Rng2 As Range 'destined another WB Dim a As Range Set Rng1 = Range("A1:B3,A5:B6") With Workbooks("Book2").Worksheets("Sheet1") 'this works if address length < 256 'Set Rng2 = .Range(Rng1.Address) For Each a In Rng1.Areas If Rng2 Is Nothing Then Set Rng2 = .Range(a.Address) Else Set Rng2 = Union(Rng2, .Range(a.Address)) End If Next End With Rng2.Interior.ColorIndex = 5 End Sub Any ideas for a something more efficient much appreciated, TIA, Sandy Savituk yahoo co uk |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Range Name Limitations - Max Refers To Length? | Excel Discussion (Misc queries) | |||
How to create a range address with ADDRESS function? | Excel Worksheet Functions | |||
Validation length, Range length | Excel Discussion (Misc queries) | |||
Variable series length/range | Charts and Charting in Excel | |||
Sending email via VB - address length | Excel Programming |