B
bijan
Hi
I found a helpful code from Mr.Thomlinson about find last item (Q1 in row 5)
___A___B____C___
1|Q1 aaa ZZ
2|Q1 bbb ZZ
3|Q1 ccc BB
4|Q1 ddd HH
5|Q1 eee GG
6|Q2 fff ZZ
7|Q2 ggg MM
the code is:
Public Sub FindLast()
Dim rngFound As Range
Dim rngToSearch As Range
Set rngToSearch = Range("A2", Cells(Rows.Count, "A").End(xlUp))
Set rngFound = rngToSearch.Find(What:="Q1", _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchDirection:=xlPrevious)
If rngFound Is Nothing Then
MsgBox "Sorry... Not Found"
Else
MsgBox "Found on row " & rngFound.Row
End If
End Sub
is it possible, I change "GG" in column C with "OK" in this code?
instead of MsgBox "Found on row " & rngFound.Row
any help appreciated
Bijan
I found a helpful code from Mr.Thomlinson about find last item (Q1 in row 5)
___A___B____C___
1|Q1 aaa ZZ
2|Q1 bbb ZZ
3|Q1 ccc BB
4|Q1 ddd HH
5|Q1 eee GG
6|Q2 fff ZZ
7|Q2 ggg MM
the code is:
Public Sub FindLast()
Dim rngFound As Range
Dim rngToSearch As Range
Set rngToSearch = Range("A2", Cells(Rows.Count, "A").End(xlUp))
Set rngFound = rngToSearch.Find(What:="Q1", _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchDirection:=xlPrevious)
If rngFound Is Nothing Then
MsgBox "Sorry... Not Found"
Else
MsgBox "Found on row " & rngFound.Row
End If
End Sub
is it possible, I change "GG" in column C with "OK" in this code?
instead of MsgBox "Found on row " & rngFound.Row
any help appreciated
Bijan