I've made my first attempt at making a number checksum creator/validation. After going round in circles, I've given up
Can some kind person please tell me where I've gone wrong with the below?
![]()
Please Login or Register to view this content.
I've made my first attempt at making a number checksum creator/validation. After going round in circles, I've given up
Can some kind person please tell me where I've gone wrong with the below?
![]()
Please Login or Register to view this content.
*******************************************************
HELP WANTED! (Links to Forum threads)
Trying to create reusable code for Custom Events at Workbook (not Application) level
*******************************************************
Can you please describe how the behavior of this code is different than the behavior you want? This is a lot of code to sift through cold.
Jeff
| | |·| |·| |·| |·| | |:| | |·| |·|
Read the rules
Use code tags to [code]enclose your code![/code]
Sorry my fault. I thought the Debug.Print messages in the first sub were sufficient.
If you run the TestMod11Checksum sub (just a sub for testing the 2 functions in the module), the final debug.print should print "The checksum validation returned: True". But it keeps printing "The checksum validation returned: False".
The test sub creates a random number, it then runs it through the first function to create a checksum digit for this number. The checksum digit is added to the end of the random number and then run through the 2nd function which is meant to validate the checksum digit. But this function keeps returning false as I said.
So somehow the two functions must not be compatible with each other. But I can't work out where.![]()
Last edited by mc84excel; 07-30-2014 at 11:38 PM. Reason: clarify
Very helpful, thanks.
When I run this code I get an overflow error on this line, with the right side equal to -53.
Debug output to that point is![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Will continue to investigate.
The normal method is to return 11 - bytRemainder as the check digit, but if you use Mod 11, the result can be 10, so you'd use a letter like X instead (and your validation function needs to convert this back to 10 when performing its calculations).
Everyone who confuses correlation and causation ends up dead.
Here's the latest version. Still not working.
![]()
Please Login or Register to view this content.
It's now starting to come together.Latest version below. Haven't tested what happens if checksum digit = 10 on a mod 11.
![]()
Please Login or Register to view this content.
making progress. now trying to allow the possibility of passing a negative number as an argument. I have a number of CRC32 checksums that I want to record with a 1 digit checksum to ensure their validity. However some of the CRC32 checksums are negative.
I think I have finished it. It now allows for negative serial number arguments and the option to use Luhn formula for mod10 checksums.
If anyone can see any error, please let me know where it is and I'll rep you for pointing it out.
![]()
Please Login or Register to view this content.
Last edited by mc84excel; 08-05-2014 at 07:47 PM. Reason: fix grammar
I discovered an error the next day. Have finally got round to posting the corrected code.
![]()
Please Login or Register to view this content.
Last edited by mc84excel; 10-27-2014 at 09:18 PM.
Thanks for the update![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks