Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can you represent this in cell notation so you can use variables?
Set My_Multiple_Range = Range("a1:a3,a7:a9") thanks John |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you can try this:
Set My_Multiple_Range = Union(Range("a1:a3"), Range("a7:a9")) -- Gary "John" wrote in message ... How can you represent this in cell notation so you can use variables? Set My_Multiple_Range = Range("a1:a3,a7:a9") thanks John |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I wasn't clear
I want something like My_multiple_Range = Range(Cells(x,y),cells(x+2,y+2):Cells(x+7,y),cells (x+7,Y+7) So that I can use x and y as variables John Gary Keramidas wrote: you can try this: Set My_Multiple_Range = Union(Range("a1:a3"), Range("a7:a9")) |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Then you want
Set My_multiple_Range = Union(Cells(x,y),cells(x+2,y+2),Cells(x+7,y),cells (x+7,Y+7)) It's not that hard. -- HTH, Barb Reinhardt "John" wrote: I wasn't clear I want something like My_multiple_Range = Range(Cells(x,y),cells(x+2,y+2):Cells(x+7,y),cells (x+7,Y+7) So that I can use x and y as variables John Gary Keramidas wrote: you can try this: Set My_Multiple_Range = Union(Range("a1:a3"), Range("a7:a9")) |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
But not quite that simple <vbg:
With ActiveSheet 'I like to qualify my ranges. Set My_Multiple_Range _ = Union(.Cells(X, Y), _ .Range(.Cells(X + 2, Y + 2), .Cells(X + 7, Y)), _ .Cells(X + 7, Y + 7)) End With or With ActiveSheet 'I like to qualify my ranges, still. Set My_Multiple_Range _ = Union(.Cells(X, Y), _ .Cells(X + 2, Y + 2).Offset(0, -2).Resize(6, 3), _ .Cells(X + 7, Y + 7)) End With Barb Reinhardt wrote: Then you want Set My_multiple_Range = Union(Cells(x,y),cells(x+2,y+2),Cells(x+7,y),cells (x+7,Y+7)) It's not that hard. -- HTH, Barb Reinhardt "John" wrote: I wasn't clear I want something like My_multiple_Range = Range(Cells(x,y),cells(x+2,y+2):Cells(x+7,y),cells (x+7,Y+7) So that I can use x and y as variables John Gary Keramidas wrote: you can try this: Set My_Multiple_Range = Union(Range("a1:a3"), Range("a7:a9")) -- Dave Peterson |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I had to take the periods out of this to get it through debug.
What I',looking for is to have a range that is the first 3 cells in a row plus cells 6 through 10 in the same row. or put another way. I want the range to include cells 1 to 10 in a row but not cells 4 through 6. And I want the row to be variable. John Dave Peterson wrote: But not quite that simple <vbg: With ActiveSheet 'I like to qualify my ranges. Set My_Multiple_Range _ = Union(.Cells(X, Y), _ .Range(.Cells(X + 2, Y + 2), .Cells(X + 7, Y)), _ .Cells(X + 7, Y + 7)) End With or With ActiveSheet 'I like to qualify my ranges, still. Set My_Multiple_Range _ = Union(.Cells(X, Y), _ .Cells(X + 2, Y + 2).Offset(0, -2).Resize(6, 3), _ .Cells(X + 7, Y + 7)) End With Barb Reinhardt wrote: Then you want Set My_multiple_Range = Union(Cells(x,y),cells(x+2,y+2),Cells(x+7,y),cells (x+7,Y+7)) It's not that hard. -- HTH, Barb Reinhardt "John" wrote: I wasn't clear I want something like My_multiple_Range = Range(Cells(x,y),cells(x+2,y+2):Cells(x+7,y),cells (x+7,Y+7) So that I can use x and y as variables John Gary Keramidas wrote: you can try this: Set My_Multiple_Range = Union(Range("a1:a3"), Range("a7:a9")) |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
It looks like that sets the individual cells rather than two ranges.
I'll give it a try tough. thanks John Barb Reinhardt wrote: Then you want Set My_multiple_Range = Union(Cells(x,y),cells(x+2,y+2),Cells(x+7,y),cells (x+7,Y+7)) It's not that hard. |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How about this
Set My_Multiple_Range = Union(Range("a1:a3"),Range("a7:a9")) -- HTH, Barb Reinhardt "John" wrote: How can you represent this in cell notation so you can use variables? Set My_Multiple_Range = Range("a1:a3,a7:a9") thanks John |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Extending Look-up to multiple cell ranges | Excel Worksheet Functions | |||
Locking multiple Cell Ranges with TimeStamp | Excel Programming | |||
Selecting multiple ranges using 'Cells' notation | Excel Programming | |||
Refer to Ranges using Cells notation | Excel Programming | |||
Multiple Vectors Notation | Excel Discussion (Misc queries) |