I have a dataset with 1 column with data that is separated by cells with "**".

XX
YY
YY
Xx
XX
Xx
**
XX
YY
YY
Xx
XX
Xx
**

Desired result after using macro (with numbers in second column):
XX 1
YY 1
YY 2
Xx 1
XX 2
Xx 2
** 1
XX 1
YY 1
YY 2
Xx 1
XX 2
Xx 2
** 1

Sadly my code isn't case sensitive, which kind of beats the purpose. My result:

XX 1
YY 1
YY 2
Xx 2
XX 3
Xx 4
** 1
XX 1
YY 1
YY 2
Xx 2
XX 3
Xx 4
** 1

Any suggestions? My current code:


Sub Number()
Dim rCell As Range, rSource As Range, rStart As Range
Dim iCounter As Integer
Set rSource = Range(Range("A1"), Range("A" & Rows.Count).End(xlUp))
Set rStart = Range("A1")

For Each rCell In rSource
If rCell.Value = "**" Then Set rStart = rCell
iCounter = Application.WorksheetFunction.CountIf(Range(rStart, rCell), rCell.Value)
rCell.Offset(0, 1).Value = iCounter
Next

End Sub
Thanks a million in advance!