View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Brad[_7_] Brad[_7_] is offline
external usenet poster
 
Posts: 7
Default The Find Method

Thank you both for the assistance, I appreciate it.

-Brad

-----Original Message-----
How about this:

Option Explicit
Sub testme01()

Dim rngRacf As Range
Dim strMaxRange As String
Dim rngBottomZero As Range

strMaxRange = 33

With Worksheets("Inquiries")
Set rngRacf = .Range("C2:C" & strMaxRange)

With rngRacf
Set rngBottomZero = .Find(what:="0000", _
After:=.Cells(1), _
LookIn:=xlValues, _
SearchDirection:=xlPrevious)
End With

If rngBottomZero Is Nothing Then
'not found
Else
.Cells(rngBottomZero.Row, "A").Resize(1,

7).Copy _
Destination:=Worksheets("sheet1").Range

("a1")
End If
End With

End Sub

I start in the firstcell of the rngRacf, but look up

(xlprevious).

The only problem I had was what "0000" really was. If I

put '0000 (as text), I
found it. If I put 0 and left it formatted as general,

xl didn't find it.

but if I gave that a custom format of "0000" w/o the

quotes, it got found.




Brad wrote:

Good afternoon,

I'm completely stumped here. What I need is to find a
certain value, by searching from the bottom of the
spreadsheet in a single column. Then take that cell
location of where the value is found, and cut (from cut
and paste) columns A - G and paste them in another
worksheet that I created.

Set rngRacf = Worksheets("Inquiries").Range("C2:" &
strMaxRange)
Set rngBottomZero = rngRacf.Find(
What:="0000", _
After:=strMaxRange, _
LookIn:=xlValues, _
SearchDirection:=xlPrevious)

strMaxRange is the second to last cell value that has
data. Assuming that the "After" designation will begin
the search in the very last cell, searching backwards

for
an instance of the value "0000" that I'm searching for.

I want rngBottomZero to have the cell location where the
criteria is found. If I just use a variant "BottomZero"
the data that I get back is just the "0000" value it
searched for. In this particular code I receive "Unable
to get the Find property of the range class." Which is
even more confusing to me because I thought Find was a
method, not a property. But I'm not sure how to

designate
it otherwise.

I'm numb from troubleshooting and I'm getting nowhere.
Any help would be greatly appreciated.

-Brad


--

Dave Peterson

.