Excel: NMEA Checksum

The following macro computes the NMEA checksum. It's pretty rudimentary and certainly it can be done better but it works. You need to manually remove the $ header and *XX checksum as per the standard prior to running the macro.

Function NMEAchecksum(a As String) As Variant
  c = 0
  CharXOR = 0
  For i = 1 To Len(a)
    c = Asc(Mid(a, i, 1))
    CharXOR = WorksheetFunction.Bitxor(c, CharXOR)
  Next i
  NMEAchecksum = WorksheetFunction.Dec2Hex(CharXOR)
End Function