I am trying to find the count of consecutive values in order to change it to another value. Example :
A
A
B
A
B
B
B
B
A
If there are consecutive values (AA, AAA, AAAA.. or BB, BBB, BBBB...) then replace the second and corresponding values with C
I tried the following code:
Dim values As Integer
values = Range().Rows.Count
For i = 1 To values
If Range().Cells(i, 1) = Range().Cells(i + 1, 1) Then
Range().Cells(i + 1, 1) = āCā
End If
Next i
However this only takes into account 2 consecutive values and not more than 2.. how do I fix my code?
Appreciate the help.
Thanks