Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default random number generator


Hey !!
I am using Random numer generator in a macro.I need input range to b
variable.

for generating random number I need values and respective probability.
start recording a macro.initially I have 5 values and respectiv
probabilities.I apply random number generator on these values with th
parameters say 30 (number of variables) ;2000(number of Random numbers
; discrete ditribution.one more parameter is needed that is "Values an
Probability input range";as there are 5 values,it takes range a
$A2$:$B$6 and generates the random numbers on a different sheet.

Now my problem is that how to take different inputs to generate rando
numbers.I have recorded macro with five values.I want macro to wor
with 6,7,8 ... intial values.basically I want to change the inpu
range.

How can I generate random numbers with "number of variables" an
"number of random numbers" other than 30 and 2000 respectively.
thanks in advance
rsank

--
rsank
-----------------------------------------------------------------------
rsankh's Profile: http://www.msusenet.com/member.php?userid=187
View this thread: http://www.msusenet.com/t-187050951

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default random number generator

Your VBA code for the parameters you intially set would look like this.....

Application.Run "ATPVBAEN.XLA!Random", , 30, 2000, 7, , ActiveSheet. _
Range("$A$2:$B$6")

The parameters can be changed into variables like this

Dim xVars As Long, xNumbers As Long, xRange As Range
xVars = 30
xNumbers = 2000
Set xRange = ActiveSheet.Range("$A$2:$B$6")

Application.Run "ATPVBAEN.XLA!Random", , xVars, xNumbers, 7, , xRange

By changing the variables (either user input or using VBA code) different
conditions for the RNG can be set.

--
Cheers
Nigel



"rsankh" wrote in message
...

Hey !!
I am using Random numer generator in a macro.I need input range to be
variable.

for generating random number I need values and respective probability.I
start recording a macro.initially I have 5 values and respective
probabilities.I apply random number generator on these values with the
parameters say 30 (number of variables) ;2000(number of Random numbers)
; discrete ditribution.one more parameter is needed that is "Values and
Probability input range";as there are 5 values,it takes range as
$A2$:$B$6 and generates the random numbers on a different sheet.

Now my problem is that how to take different inputs to generate random
numbers.I have recorded macro with five values.I want macro to work
with 6,7,8 ... intial values.basically I want to change the input
range.

How can I generate random numbers with "number of variables" and
"number of random numbers" other than 30 and 2000 respectively.
thanks in advance
rsankh


--
rsankh
------------------------------------------------------------------------
rsankh's Profile: http://www.msusenet.com/member.php?userid=1879
View this thread: http://www.msusenet.com/t-1870509512



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default random number generator


Thanks ..it worked !

--
rsank
-----------------------------------------------------------------------
rsankh's Profile: http://www.msusenet.com/member.php?userid=187
View this thread: http://www.msusenet.com/t-187050951

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
random number generator johnny vino Excel Discussion (Misc queries) 8 April 25th 07 05:51 PM
random number generator Barb Excel Discussion (Misc queries) 2 September 22nd 06 11:12 PM
Random Number Generator Pascale Excel Worksheet Functions 3 July 9th 05 12:37 AM
random number generator Jose Luis Excel Discussion (Misc queries) 1 June 14th 05 09:41 PM
Random Number Generator Brad[_13_] Excel Programming 4 December 18th 03 03:41 PM


All times are GMT +1. The time now is 08:57 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright İ2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"