Selecting multiple areas

  • Thread starter Thread starter Jim Tibbetts
  • Start date Start date
J

Jim Tibbetts

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.
 
Sorting work on contiguous ranges.

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

Set r1=range("A1:A5")
set r2=range("Z1:Z100")
set r3=UNION(r1,r2)
 
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
 
Thanks for the reply. That would work. However, I'm finding out I can't sort
multiple selections anyway.
 
Thanks Bernie. I didn't know you couldn't sort noncontiguous ranges. I'll
sort the ranges separately.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top