There is Analysis ToolPak and Analysis ToolPak - VBA. I think you need both.
However, if still won't work then replace the following code
Because RandBetween is not a native Excel function (in 2003 and
earlier), it is not going to be found under WorksheetFunction. If you
have the ATP VBA reference (you don't need both ATP references, just
the VBA one), you can call RandBetween as if it were a native VBA
function. Note that you must have the add-in loaded and your project
must reference the atpvbaen.xla library.
L = RandBetween(1, 100)
When I use functions from another library, I like to qualify the name
of the function with the library name, just to keep things clear and
well documented.
L = [atpvbaen.xls].RandBetween(1, 100)
The [ ] chars are required because the library name contains a period
(and yes, the referenced library is "xls" not "xla").
Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com
On Wed, 24 Mar 2010 13:01:02 -0700, OssieMac
wrote:
Hi Bradley,
There is Analysis ToolPak and Analysis ToolPak - VBA. I think you need both.
However, if still won't work then replace the following code
lngRandom = WorksheetFunction _
.RandBetween(1, lngCells)
with these 2 lines of code
Randomize
lngRandom = Int((lngCells * Rnd) + 1)