lundi 12 janvier 2015

vba send equation command to function

Hard to put a title to it, but that's the best I could think of!


Basically, I have a function in VBA that you send some parameters to, and then it does some maths with it to give a value. One of the parameters I send is either a "<" or a ">", which are later used in an if statement of



if x > y


or



if x < y


depending on which I send.


At present, I send this as a string, labelled "constraint", and do the following;





if constraint = ">" then
if x > y

*code*
end if

elseif constraint = "<" then
if x < y
*code*
end if
end if



if that makes sense.


This gets complicated with the other code I have; is there a way I can neaten this up into one if statement?


Cheers, and I hope that makes sense


Aucun commentaire:

Enregistrer un commentaire