LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Selection multiple ranges with Cells property

How can I select multiple non-adjacent ranges using the Cells property.
I know that Range("A2:A7, F2:F7, J2:J7").Select works. However the number of
rows varies each time the macro is run. Also, although the number of rows may
vary each time the macro is run the number of rows in A, F, and J
respectively, remain equal with each run. I've tried the following

' I = last data row
Dim R1, R2, R3, MyMultipleRange As Range
Sheets("Scratch").Select
R1=Range(Cells(2, 1), Cells(I, 1))
R2=Range(Cells(2, 6), Cells(I, 6))
R3=Range(Cells(2, 10), Cells(I, 10))
Set myMultipleRange = Union(R1, R2 R3)
myMultipleRange.Select

with no success. I plan to use the selected range in a ListBox and have been
able to do this if I make the three columns of data adjacent. But I thought
I'd ask for expert help first. Can it be done without making the columns
adjacent? Or, is there a better way?
Thanks

 
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
Enter value zero into all cells in multiple ranges? Al Excel Discussion (Misc queries) 4 November 26th 09 06:34 AM
Turn off Automatic Selection of Multiple cells. klm[_2_] Excel Discussion (Misc queries) 1 December 12th 07 03:38 PM
Counting cells with multiple selection ub Excel Worksheet Functions 2 March 15th 07 10:35 PM
Relative Ranges - Multiple Cells Helen Excel Programming 1 July 12th 06 12:55 PM
Add and Subtract ranges (with multiple cells) in vba Jon5001 Excel Programming 1 April 3rd 05 06:46 PM


All times are GMT +1. The time now is 04:57 PM.

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

About Us

"It's about Microsoft Excel"