Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Selecting a range of a Find object

I use Cells.Find to locate a column. How do I select a certain range
within the column of the found range?

'-------------------Here is the dumbed down version of the code:
Set testrng = Cells.Find(What:="Selections",
After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not testrng Is Nothing Then
Selection.copy


I know this selects the whole column:


testrng.EntireColumn.Copy


I want to be able to do this:


Range(testrng.column & "65536").end(xlup).
(offset(1,0).copy '(or paste)

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Selecting a range of a Find object

Well I used testrng.offset to get to where I wanted in the column in
combination with the Range object to select multiple cells. But does
anyone know of a cleaner way to do this? Thanks.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Selecting a range of a Find object

Dim DestCell as range
dim testrng as range
set testrng = yourfindhere(...)

if testrng is nothing then
'do nothing
else
with activesheet
set destcell = .cells(.rows.count,testrng.column).end(xlup).offse t(1,0)
end with

something.copy _
destination:=destcell
end if



Kigol wrote:

I use Cells.Find to locate a column. How do I select a certain range
within the column of the found range?

'-------------------Here is the dumbed down version of the code:
Set testrng = Cells.Find(What:="Selections",
After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
If Not testrng Is Nothing Then
Selection.copy

I know this selects the whole column:

testrng.EntireColumn.Copy

I want to be able to do this:

Range(testrng.column & "65536").end(xlup).
(offset(1,0).copy '(or paste)


--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Selecting a range of a Find object

On Feb 22, 2:20*pm, Dave Peterson wrote:
Dim DestCell as range
dim testrng as range
set testrng = yourfindhere(...)

if testrng is nothing then
* 'do nothing
else
* with activesheet
* * *set destcell = .cells(.rows.count,testrng.column).end(xlup).offse t(1,0)
* end with

* something.copy _
* * destination:=destcell
end if





Kigol wrote:

I use Cells.Find to locate a column. How do I select a certain range
within the column of the found range?


'-------------------Here is the dumbed down version of the code:
Set testrng = Cells.Find(What:="Selections",
After:=ActiveCell, LookIn:=xlFormulas, LookAt:=xlWhole,
SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False)
* * * * If Not testrng Is Nothing Then
Selection.copy


I know this selects the whole column:


* * * * * * * *testrng.EntireColumn.Copy


I want to be able to do this:


* * * * * * * *Range(testrng.column & "65536").end(xlup)..
(offset(1,0).copy '(or paste)


--

Dave Peterson- Hide quoted text -

- Show quoted text -


Cool thanks.
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 a range of a Find object Kigol Excel Programming 1 February 23rd 08 04:18 AM
Selecting Drawing Object By Name Zone Excel Programming 3 December 22nd 06 08:21 PM
Range Object with Find and Offset Ctal[_2_] Excel Programming 1 March 3rd 05 02:45 PM
Selecting object Ronbo Excel Programming 2 January 13th 05 12:06 PM
Selecting cells which do not meet a formatting criteria, and assigning a Range object to these. SuperJas Excel Programming 5 February 23rd 04 03:36 AM


All times are GMT +1. The time now is 08:03 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"