Find match in column and then paste to adjacent cell

  • Hi, I am trying to search column A in worksheet 2 to a match in cell A5 in worksheet 1. The values will be numbers only and column A in worksheet 2 will not have duplicate values. If there is a match, paste the word "cleared" to column b of the corresponding row in worksheet 2. Any help would be greatly appreciated.

  • You could do this with formulae, but here is one way using code. Adjust sheet names if necessary.
    [vba]Sub x()


    Dim rFind As Range


    With Sheets("Sheet2").Columns(1)
    Set rFind = .Find(What:=Sheets("Sheet1").Range("A5"), LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
    If Not rFind Is Nothing Then
    rFind.Offset(, 1).Value = "cleared"
    End If
    End With


    End Sub[/vba]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!