Hello
Try this code
Sub Test() Dim c As Range Dim i As Long For Each c In Range("B2:B" & Cells(Rows.Count, 1).End(xlUp).Row) If c = "No" Then i = i + 1 c.Offset(, 1) = i ElseIf c = "Yes" Then c.Offset(, 1) = i + 1 i = 0 End If Next c End Sub
Hello
Try this code
Sub Test() Dim c As Range Dim i As Long For Each c In Range("B2:B" & Cells(Rows.Count, 1).End(xlUp).Row) If c = "No" Then i = i + 1 c.Offset(, 1) = i ElseIf c = "Yes" Then c.Offset(, 1) = i + 1 i = 0 End If Next c End Sub