Find & Replace with two condition in VBA

B

bijan

Hi All,
I have a sheet like this:
A B C
1 2B2 1 NRC
2 2B2 2 WW
3 2C2 1 BLK
4 2C2 2 BLK
5 2C2 3 BLK
How can I find 2C2 with value 3 in column B (row 5) and change BLK in column
C
with whatever I want?
 
B

Bob Phillips

Find and Replace (Ctrl-H) will do that, so just do it with the macro
recorder switched on.
 
B

bijan

Thank you Mr.Phillips for your answer,I found a sample code that detect the
last item,actualy I first need to find last item and then replace something
in column C
this 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:="2C2", _
LookIn:=xlFormulas, _
LookAt:=xlWhole, _
SearchDirection:=xlPrevious)
If rngFound Is Nothing Then
MsgBox "Sorry... Not Found"
Else
REPLACEMENT
End If
End Sub
what I need now is just replace "test" to "BLK" in column c (in REPLACEMENT)
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