Jump to content

Recommended Posts

Posted

In my VBA code based on user input it has to execute the statement

 

I need a code for this statement

 

i created two text box. one for input and other for output

 

If the input value is between 1 to 10 (it means the value may be 1 or 2 or 3 or 4 etc.....) then it need to show "A" in output

 

similarly If the input value is between 11 to 20 then it need to show "B" in output

Posted

the simple way to do this is to restrict the textbox keypress to 0-9 only, then after pressed, read the value. THe problem you are going to have is if the user intends to press 12, when the 1 is pressed, textbox2 will display A, then when the 2 is pressed, it will change to B. What do you have so far?

Posted

I have wrote a couple of programs that do this in VB .Net using "Regular Expressions". Do a quick Google search to see how to use them. You should be able to test for a wide variety of conditions. I use this alot to convert between units of measure.

Posted

Couldn't you use a if ?

 

If > 0.5 and

If > 10.6 and

 

If lots of numbers use case, if only two 10.5

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...