Selecting a range of a Find object

K

Kigol

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)
 
K

Kigol

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.
 
D

Dave Peterson

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).offset(1,0)
end with

something.copy _
destination:=destcell
end if
 
K

Kigol

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).offset(1,0)
  end with

  something.copy _
    destination:=destcell
end if











--

Dave Peterson- Hide quoted text -

- Show quoted text -

Cool thanks.
 

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

Top