I haven't looked at this properly, but just giving it a quick glance, I think you need to zero the variable CHECKSUM before starting the FOR/NEXT loop.