Fonction VBA : intRand

La fonction VBA intRand renvoie un entier aléatoire compris entre 2 valeurs.

Utilisation :

intRand(valeur_min, valeur_max)


Exemple d'utilisation

Génération d'un nombre entier aléatoire entre -5 et 25 intRand(-5, 25) :

Sub exemple()

    nombreAleatoire = intRand(-5, 25)
    
    MsgBox nombreAleatoire

End Sub
fonction vba excel int rand

Remarque : cette fonction nécessite l'installation du pack de fonctions XLP (un add-in gratuit pour Excel qui ajoute 92 nouvelles fonctions).