ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting multiple areas (https://www.excelbanter.com/excel-programming/403659-selecting-multiple-areas.html)

Jim Tibbetts

Selecting multiple areas
 
Can some one please help me with this line of code. I am trying to select 2
separate areas so they can be sorted together.

Range("A10:E" & Range("TEAMCOUNT").Value + 9),"G10:H" &
Range("TEAMCOUNT").Value + 9").Select

It seems that no matter what I do I get an error message.
--
Jim T

Dave Peterson

Selecting multiple areas
 
Sorting work on contiguous ranges.

You can sort each area separately -- or sort A10:H##.



Jim Tibbetts wrote:

Can some one please help me with this line of code. I am trying to select 2
separate areas so they can be sorted together.

Range("A10:E" & Range("TEAMCOUNT").Value + 9),"G10:H" &
Range("TEAMCOUNT").Value + 9").Select

It seems that no matter what I do I get an error message.
--
Jim T


--

Dave Peterson

Gary''s Student

Selecting multiple areas
 
Use UNION:

Set r1=range("A1:A5")
set r2=range("Z1:Z100")
set r3=UNION(r1,r2)
--
Gary''s Student - gsnu200763


"Jim Tibbetts" wrote:

Can some one please help me with this line of code. I am trying to select 2
separate areas so they can be sorted together.

Range("A10:E" & Range("TEAMCOUNT").Value + 9),"G10:H" &
Range("TEAMCOUNT").Value + 9").Select

It seems that no matter what I do I get an error message.
--
Jim T


Bernie Deitrick

Selecting multiple areas
 
Jim,

The code to select separate areas would be:

Range("A10:E" & Range("TEAMCOUNT").Value + 9 & ",G10:H" & Range("TEAMCOUNT").Value + 9).Select

BUT... you can't sort with multiple ranges selected.... Sorry.

HTH,
Bernie
MS Excel MVP


"Jim Tibbetts" wrote in message
...
Can some one please help me with this line of code. I am trying to select 2
separate areas so they can be sorted together.

Range("A10:E" & Range("TEAMCOUNT").Value + 9),"G10:H" &
Range("TEAMCOUNT").Value + 9").Select

It seems that no matter what I do I get an error message.
--
Jim T




Jim Tibbetts

Selecting multiple areas
 
Thanks for the reply. That would work. However, I'm finding out I can't sort
multiple selections anyway.
--
Jim T


"Gary''s Student" wrote:

Use UNION:

Set r1=range("A1:A5")
set r2=range("Z1:Z100")
set r3=UNION(r1,r2)
--
Gary''s Student - gsnu200763


"Jim Tibbetts" wrote:

Can some one please help me with this line of code. I am trying to select 2
separate areas so they can be sorted together.

Range("A10:E" & Range("TEAMCOUNT").Value + 9),"G10:H" &
Range("TEAMCOUNT").Value + 9").Select

It seems that no matter what I do I get an error message.
--
Jim T


Jim Tibbetts

Selecting multiple areas
 
Thanks Dave.
--
Jim T


"Dave Peterson" wrote:

Sorting work on contiguous ranges.

You can sort each area separately -- or sort A10:H##.



Jim Tibbetts wrote:

Can some one please help me with this line of code. I am trying to select 2
separate areas so they can be sorted together.

Range("A10:E" & Range("TEAMCOUNT").Value + 9),"G10:H" &
Range("TEAMCOUNT").Value + 9").Select

It seems that no matter what I do I get an error message.
--
Jim T


--

Dave Peterson


Jim Tibbetts

Selecting multiple areas
 
Thanks Bernie. I didn't know you couldn't sort noncontiguous ranges. I'll
sort the ranges separately.
--
Jim T


"Bernie Deitrick" wrote:

Jim,

The code to select separate areas would be:

Range("A10:E" & Range("TEAMCOUNT").Value + 9 & ",G10:H" & Range("TEAMCOUNT").Value + 9).Select

BUT... you can't sort with multiple ranges selected.... Sorry.

HTH,
Bernie
MS Excel MVP


"Jim Tibbetts" wrote in message
...
Can some one please help me with this line of code. I am trying to select 2
separate areas so they can be sorted together.

Range("A10:E" & Range("TEAMCOUNT").Value + 9),"G10:H" &
Range("TEAMCOUNT").Value + 9").Select

It seems that no matter what I do I get an error message.
--
Jim T






All times are GMT +1. The time now is 12:16 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com