Macro to Search for a word and put a code on the cell next to it

[Solved/Closed]
Report
-
 A.E -
Hello,
I'd like to scan a column for a certain word ("TOTAL LINE") and put a code (e.g "a") on the cell next to it each time it finds it.In case that raw is dynamic

1 reply

Posts
341
Registration date
Tuesday March 3, 2015
Status
Moderator
Last seen
July 3, 2015
68
Sub go()
Dim i As Integer, Cell As Range, Cell2 As Range
i = 1
'This will Search Sheet1 Column1
'and set the value to cell next
Do Until ThisWorkbook.Sheets(1).Cells(i, 1).Value = ""
    Set Cell = ThisWorkbook.Sheets(1).Cells(i, 1)
    Set Cell2 = ThisWorkbook.Sheets(1).Cells(i, 2)
    If Cell.Value = "TOTAL LINE" Then
        Cell2.Value = "a"
    End If
i = i + 1
Loop

End Sub
thank you for your respond