Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

How can I set a text box to accept only integers?

  Asked By: Pedro    Date: Dec 12    Category: MS Office    Views: 1083
  

I'm just starting out.

1. How can I set a text box to accept only integers?
2. I have created a "Submit" button on a form which posts data
entered in the form onto a spreadsheet. If all textboxes are not
filled in (with numbers > 0), I would like to put up a message box
complaining that this is the case and refusing to proceed until all
data is filled in. There are 36 text boxes (conveniently labeled
textbox1 - textbox36), and I suppose I could put in something like If
textbox1 >0 and textbox2>0.......... I'm not really sure how to do
this, but there has to be a better way, no?
3. I want to do a populate a textbox (37) with a value obtained in a
vlookup. I can do this, but I want to lookup in a database which is
occasionally augmented, so I don't want to hardwire the range
selection. I know how to get the number of the last row, and the last
column doesn't change, so I imagine there's a way to put the variable
representing the last row in the vlookup formula, but I can't figure
it out.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Muntasir Bashara     Answered On: Dec 12

Foir the
Ans 1: use teh TextBox Keypress event and check the KeyAscii value should be
between 48 to 57 which is basically represents 0 to 9

Ans 2: Create a contro Array of TextBox and When usre press submit button  loop
through each control and check the value>0

 
Answer #2    Answered By: Cadencia Bernard     Answered On: Dec 12

Thanks, but, although I'm sure these answers are accurate, I really
don't know how to do either of the things you suggest. Can you give
me a little more instruction please?

 
Didn't find what you were looking for? Find more on How can I set a text box to accept only integers? Or get search suggestion and latest updates.




Tagged: