I thought that was going to be easy, but it's anything but. The IsText function, doesn't work as it assumes that everything in the textbox is text; even numeric data.
There are probably heaps of better solutions and I'm sure (and hope) that someone will make a better suggestion, but here is my solution.
My logic is as follows:
- Dimension a variable as numeric so it can't contain text.
- Try to store the contents of the textbox in the numeric variable
- If it can be stored, it is a number
- If it can't be stored, then the error handling will kick in and the err.number will equal 13 not 0. i.e. it must have been text.
HTH
Martin
Bookmarks