Limit range of values for integer

A

Alan

In VBA (used in Excel), is there a way to limit the range of values of
a variable. For example, if I want to have an integer but only have
it range from 1 - 100 in value, how would I do that.

Thanks, Alan
 
D

dksaluki

you could test for the value of the interger. something like this:

If i > 0 or <=100 then
'do something here
Else
MsgBox "Please pick integer in the range of 1-100"
End If


....you could also use a SELECT....CASE block
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top