Hi,
I'd like to create new variable type, where the variable could be decimal and would be between 0 and 1 (like a probability). Is it possible to restrict variable between some lower and upper values?
Hi,
I'd like to create new variable type, where the variable could be decimal and would be between 0 and 1 (like a probability). Is it possible to restrict variable between some lower and upper values?
Why don't you use Data Validation for your cells.
Select your cell, Select the Data Tab and then Data Validation.
Set your validation to
Decimal
Min 0 Max 1
My General Rules if you want my help. Not aimed at any person in particular:
1. Please Make Requests not demands, none of us get paid here.
2. Check back on your post regularly. I will not return to a post after 4 days.
If it is not important to you then it definitely is not important to me.
VBA does not support that as a built-in feature (the only language I know that does this is Ada). You can build a Class to do this. Here is the class, and a test:
Class Module Unit:
Test driver:Please Login or Register to view this content.
Please Login or Register to view this content.
Thank you 6StringJazzer. I was reading about defining variables in Class module, but couldn't find a working example. Your example is great. Thank you again.
Last edited by walduxas; 02-05-2021 at 02:24 AM.
I gave a very general-purpose solution to your question. If you are specifically dealing with input to a UDF, that is an overly complicated solution. It may make more sense to simply check the value in the UDF rather than creating a class to deal with it:
Please Login or Register to view this content.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks