Counter is just a variable that holds the rownumber and it increments with 1 on every loop.
Sub test1()
For Counter = 2 To Range("B" & Rows.Count).End(xlUp).Row
If Cells(Counter, 2) = "SALAME" Then Cells(Counter, 4) = Replace(Cells(Counter, 4), "AURORA ALIM.", "AURORA")
Next
End Sub
at first loop counter starts at 2
cells(counter,2) = range("B2")
cells(counter,4) = range("D2")
next loop counter is 3
cells(counter,2) = range("B3")
cells(counter,4) = range("D3")
and so one....until all filled cells in column B are passed.
No need to use end if if all statements are on 1 codeline.
Could also be written as
If Cells(Counter, 2) = "SALAME" Then
Cells(Counter, 4) = Replace(Cells(Counter, 4), "AURORA ALIM.", "AURORA")
End If
PS: Thanks for rep+.
Bookmarks