423,491 Members | 1,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,491 IT Pros & Developers. It's quick & easy.

input within a textbox in VBA

P: n/a
Hello,
I'm busy with VBA in excel.
Does anybody know how to control the input within a textbox? For example, a
textbox must contain only numbers and no text. The program must give a
warning if you type text in the textbox.

Greetings,
Hans
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In VBA, you need to create an 'on change' event for that control. Each time
the user modifies the contents of the textbox, you can use
isnumeric(yourcontrolname.text) = True to determine if the input is valid.
If the input is not numeric, you can issue a warning message to a label or
message box. Then I would use yourcontrolname.setfocus to highlight the
contents of that text box.

Hope this helps.

"avocursist59lok1" <av**************@avo-bedrijf.nl> wrote in message
news:3f***********************@news.xs4all.nl...
Hello,
I'm busy with VBA in excel.
Does anybody know how to control the input within a textbox? For example, a textbox must contain only numbers and no text. The program must give a
warning if you type text in the textbox.

Greetings,
Hans

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.