Log in

View Full Version : [SOLVED:] Find Question



remy988
10-10-2012, 12:53 PM
hi,
i have this code that basically works for me. If a find is successful, it places a "Y" in the same row, next column by using Application.GoTo to figure out the row.
how can i eliminate using the Application.GoTo and still be able to place a "Y" if a find is successful?


Sub LookItUp()
With ActiveSheet
lastrw = .Cells(.Rows.Count, 2).End(xlUp).Row
For i = 2 To lastrw
ckt = .Range("b" & i)
Set rFound = .Columns(3).Find(What:=ckt, After:=.Cells(1, 3), LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:=False _
, SearchFormat:=False)
On Error GoTo 0
If Not rFound Is Nothing Then
Application.Goto rFound, True
rw = ActiveCell.Row
.Range("d" & rw) = "Y"
End If
Next i
End With
End Sub


thanks
rem

mancubus
10-10-2012, 01:13 PM
hi.

try this...



If Not rFound Is Nothing Then
.Range("D" & rFound.Row) = "Y"
End If

remy988
10-10-2012, 06:24 PM
mancubus,

thank you very much!

rem

mancubus
10-10-2012, 11:04 PM
you're wellcome.
glad it helped