Public Function RowCounter(ByVal strKey As String,ByVal booReset As Boolean,Optional ByVal strGroupKey As String) As Long
Static col As New Collection
Static strGroup As String
On Error GoTo Err_RowCounter
If booReset=True Or strGroup <> strGroupKey Then
Set col = Nothing
strGroup = strGroupKey
Else
col.Add col.Count + 1, strKey
End If
(RowCounter = col(strKey
End Function