|
-
Aug 31st, 2011, 10:08 PM
#1
Thread Starter
New Member
[SOLVED:Excel] Selecting non-adjacent cells with Union
I need to make multiple selections of non-adjacent cells in Excel:
Union(Range(Cells(7, 2), Cells(17, 2)), Range(Cells(7, 4), Cells(17, 4))).Select
What makes my problem tricky is that the number of ranges I need to pass through the union method varies depending on other information in the file determined at runtime. Sometimes I will select 2 ranges, other times 3 ranges, etc. I tried to put the ranges in a string variable:
InStr="Range(Cells(7, 2), Cells(17, 2)), Range(Cells(7, 4), Cells(17, 4))"
Union(InStr).Select
But it appears that you can only pass range type variables through the union method. Does anyone have any idea on how I can program this without using brute force? I don't have to use union, I just use this since this is what I know to use for non-adjacent selections.
Thanks in advance!
Last edited by kinch956; Sep 1st, 2011 at 07:37 PM.
Reason: Solved Issue
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|