Place this code in a standard module and run it from the Tools >> Macros Menu on your worksheet
Public Sub SamT()
Dim i as long
Dim LastRow As Long
With ActiveSheet
.Range("A1") = 1
LastRow = .Cells(Rows.Count, "E").End(xlUp).Row
For i = 3 to lastrow
If .Cells(i, "E") = .Cells(i-1, "E") And .Cells(i, "B") = .Cells(i-1, "B" Then
.Cells(i, "A") = .Cells(i-1, "A" + 1
Else
.Cells(i, "A") = 1
End if
End With
End Sub
Please, Kost4din, study this code and my previous pseudocode and LEARN how to write very basic VBA. VBA is Basic English, It's not like C# where you have to memorize a bunch of cryptic code symbols.