dimanche 7 octobre 2018

vba function for multiple statement

Hello I'm looking to create a vba functions from an excel function. The excel function works correctly but problem is function is very long and maximum number of "if" is reached.

This is a part of the excel function:

=IF(E49>=E50+$A$1;1;IF(E49<=E50-$A$1;-1;IF(E48>=E50+$A$1;1;IF(E48<=E50-$A$1;-1;IF(E47>=E50+$A$1;1;IF(E47<=E50-$A$1;-1;IF(E46>=E50+$A$1;1;IF(E46<=E50-$A$1;-1;.... ... ... ...

I need a simple if statement that tell if cell E49 is >= or <= of cell E50+$A$1, if not move on upper cell E48 and check if value is >= or <= of cell E50+$A$1, in not move on upper cell E47 .................

I need to start an if loop that end when the statement is reached.

I hope I've explained well.

Thank you for your help.

Aucun commentaire:

Enregistrer un commentaire