BrianExcel
Well-known Member
- Joined
- Apr 21, 2010
- Messages
- 975
How should numbers be formatted so that VBA code will recognize any leading or trailing zeros?
For example, I have a list of locations, each with a unique 4-digit location number. But, some of these start with zero, whereas some start with any other number between 1 and 9.
Right now when I type the center number into a text box and hit a button, it performs code I've written, but I want to make sure the user always types in the 4 digit number, even if it means they type in 0123 instead of just 123. This way in case there is a 1123 or 2123 or any other string with a '123' somewhere in it, it ensures they are finding the right record.
Thoughts?
For example, I have a list of locations, each with a unique 4-digit location number. But, some of these start with zero, whereas some start with any other number between 1 and 9.
Right now when I type the center number into a text box and hit a button, it performs code I've written, but I want to make sure the user always types in the 4 digit number, even if it means they type in 0123 instead of just 123. This way in case there is a 1123 or 2123 or any other string with a '123' somewhere in it, it ensures they are finding the right record.
Thoughts?