乱数を使用する

ExcelVBAで乱数を使用する方法です。
rnd() とすることで、0以上1未満の乱数が生成されます。
例えば、1~5までの5個の乱数を生成したい場合は、

int(rnd()*5)+1

となります。
10~20の11個の乱数を生成したい場合は、

int(rnd()*11)+10

となります。

VBAのお勉強 まとめに戻る

Leave a Reply

(required)

(required)

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© 2011 simple blog いろいろ勉強中 Suffusion theme by Sayontan Sinha