Excel: Blank Seed Argument in RANDOM() Results in ErrorLast reviewed: November 22, 1994Article ID: Q83313 |
The information in this article applies to:
SUMMARYMicrosoft Excel version 4.0 includes an add-in function, RANDOM(), that generates a set of random numbers. When you use this function in a macro, if you leave the seed argument blank, the macro stops execution and Microsoft Excel displays the error message, "An error has occurred locating a support file or processing data for an add-in procedure."
MORE INFORMATIONThe RANDOM() macro function is parallel to choosing Analysis Tools from the Options menu and selecting Random Number Generation from the Analysis Tools list. Using the Options menu method, it is not necessary to place a seed value in the Random Seed box. Microsoft Excel still generates random numbers. Although the "Microsoft Excel Function Reference" lists the seed argument as optional when using the RANDOM() macro function, omitting it generates the error mentioned above. To avoid the error, use any integer value between 0 (zero) and 32767 in the seed argument. Note, however, that if you use a constant number other than 0, RANDOM() will generate the same set of numbers each time your macro runs. To generate different numbers, use 0 or INT(RAND()*<range>) as the seed argument, where <range> represents the upper limit of the numbers you want to use for seed values. For example, to generate seed values between 0 and 9, use 10 as your range value, for seed values between 0 and 99 use 100, and so on.
ExampleThe following sample macro demonstrates the use of the function RANDOM().
REFERENCES"Microsoft Excel Function Reference," version 4.0, pages 345-346 "Microsoft Excel User's Guide 2," version 4.0, pages 38-40
|
KBCategory: kbtool
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |