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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default 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



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default 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




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
Selecting/Copying Variable Areas Constantly Amazed Excel Programming 3 April 26th 07 01:00 PM
Multiple print areas grahammal[_19_] Excel Programming 4 February 28th 06 03:25 PM
Multiple plot areas Katie Charts and Charting in Excel 1 November 16th 05 10:35 PM
Multiple Print areas in same sheet? Enzo Excel Discussion (Misc queries) 4 August 29th 05 07:58 PM
Set Multiple Print Areas James Hamilton Excel Discussion (Misc queries) 1 June 22nd 05 06:03 AM


All times are GMT +1. The time now is 06:08 PM.

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

About Us

"It's about Microsoft Excel"