How to allow only input of numerical values in userform text-box using Excel VBA
91.9 هزار بار بازدید -
12 سال پیش
-
How can we prevent users
How can we prevent users to avoid errors while entering data into a User Form in MS Excel? Often we need to enter only numerical values for the price of an item in a text-box on a user-form. We can achieve this by using Excel VBA.
Since the data entry happens on 'key press' we use this feature to capture any invalid entries like alpha values. Each key-stroke or key-press is assigned a numerical value in the American standard Code for Information Interchange or ASCII. Wikipedia describes ASCII as: The American Standard Code for Information Interchange (ASCII) is a character-encoding scheme originally based on the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text. Most modern character-encoding schemes are based on ASCII, though they support many additional characters.
Using the above information we can write our code that allows users to only enter numerical data into a text-box on a user-form.
Since the data entry happens on 'key press' we use this feature to capture any invalid entries like alpha values. Each key-stroke or key-press is assigned a numerical value in the American standard Code for Information Interchange or ASCII. Wikipedia describes ASCII as: The American Standard Code for Information Interchange (ASCII) is a character-encoding scheme originally based on the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text. Most modern character-encoding schemes are based on ASCII, though they support many additional characters.
Using the above information we can write our code that allows users to only enter numerical data into a text-box on a user-form.
12 سال پیش
در تاریخ 1392/01/19 منتشر شده
است.
91,923
بـار بازدید شده