Perhaps

change
        If a(i, 1) <> "TOTAL" Then
to
        If (a(i, 1) = "") + (IsNumeric(a(i, 1))) Then