LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Select Non Contigouos Ranges

I went with your Subject line, but in re-looking at your code, it appears
you don't need to select the range... your ultimate goal is to simply Copy
it. Change the .Select in the last code line (the Union statement) to .Copy
in order to do that.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
I think this does what you want...

Dim FoundDate As Range
Set FoundDate = Columns("A").Find(What:="Date", After:=ActiveCell, _
LookIn:=xlFormulas, SearchOrder:=xlByRows, _
LookAt:=xlPart, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Offset(1, 0)
With FoundDate
Union(.Resize(.End(xlDown).Row - .Row + 1), _
.Resize(.End(xlDown).Row - .Row + 1).Offset(, 4)).Select
End With

Rick


"LuisE" wrote in message
...
I need to select all the cells underneath a "found" cell in column A and
then
also the corresponding cells four columns to the right.

Here is what I have, it selects the entire range including columns in
between and an "Object Required" error.

Dim FoundDate As Range
Set FoundDate = Columns("A:A").Find(What:="Date", After:=ActiveCell,
LookIn:=xlFormulas, LookAt:=xlPart, SearchOrder:=xlByRows,
SearchDirection:=xlNext, MatchCase:= False, SearchFormat:=False)
'.Activate

Union(Range(FoundDate.Offset(1, 0), Selection.End(xlDown)).Select,
Range(FoundDate.Offset(0, 4), Selection.End(xlDown)).Select).Copy


I also struggle to understand set, object required dilema, any reference
in
plain English?

Thanks in advance





 
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
Select ranges of data with a macro Simon - M&M[_2_] Excel Programming 2 September 6th 07 01:50 PM
macro to search for & select ranges to sum Jason Head Excel Programming 1 June 14th 06 02:28 AM
Inputbox - Select ranges cottage6 Excel Programming 2 September 1st 05 07:19 PM
Select instersection of two ranges Bert[_3_] Excel Programming 1 February 16th 04 05:01 PM
VBA-Select several ranges using variables waveracerr[_8_] Excel Programming 2 February 10th 04 11:12 PM


All times are GMT +1. The time now is 11:08 AM.

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"