You would need to use VBA to validate the data that goes into the textbox. If this textbox is on an actual worksheet, I would suggest you use validation instead....
1. Select data....validation... from the excel menu.
2. Select "Whole Number" or "Decimal" and set the criteria, then press OK.
HTH
Cal
PS-if you do need the vba, let me know.