I have a sub procedure that imports data from an Excel spreadsheet. This works fine, apart from when account numbers beyond a certain length are encountered. In these cases, there is a comparison problem.
For example, if an account number is 1111-2222-3333-4444
I first remove the hyphens, leaving 1111222233334444.
I then compare it against a stored format (e.g. XXXXXXXXXXXXXXXX), using just the length of both strings. If the lengths match - as they should, in this example - the format is allowed and the rest of the procedure is carried out.
Where the problem occurs is that this only works for smaller numbers. The number shown above is being interpreted as 1.11122233344E+15, which obviously means that the comparison returns 'False'.
This occurs on the spreadsheet itself, as well. If I use Format - Cells to change it to 'Text', the same format change occurs.
Any ideas how I can stop a number becoming something else entirely when I change it to text?
For example, if an account number is 1111-2222-3333-4444
I first remove the hyphens, leaving 1111222233334444.
I then compare it against a stored format (e.g. XXXXXXXXXXXXXXXX), using just the length of both strings. If the lengths match - as they should, in this example - the format is allowed and the rest of the procedure is carried out.
Where the problem occurs is that this only works for smaller numbers. The number shown above is being interpreted as 1.11122233344E+15, which obviously means that the comparison returns 'False'.
This occurs on the spreadsheet itself, as well. If I use Format - Cells to change it to 'Text', the same format change occurs.
Any ideas how I can stop a number becoming something else entirely when I change it to text?