Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Random Number in VBA

I need a random number generated in a UDF. I tried using
worksheetfunction.rand() without success. The number needs to be
uniformly distributed between 0 and 1. Any ideas?

Thanks

Chris Roenbaugh

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Random Number in VBA

Public Function MyFunc()
num = rnd
MyFunc = num
End Function

--
Regards,
Tom Ogilvy


"C. Roenbaugh" wrote in message
oups.com...
I need a random number generated in a UDF. I tried using
worksheetfunction.rand() without success. The number needs to be
uniformly distributed between 0 and 1. Any ideas?

Thanks

Chris Roenbaugh



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Random Number in VBA

=Rnd()


"C. Roenbaugh" wrote:

I need a random number generated in a UDF. I tried using
worksheetfunction.rand() without success. The number needs to be
uniformly distributed between 0 and 1. Any ideas?

Thanks

Chris Roenbaugh


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Random Number in VBA

Think you mean

=Rand()

But he appeared to be familiar with that since he was trying to use it in
VBA.

--
Regards,
Tom Ogilvy


"Gary''s Student" wrote in message
...
=Rnd()


"C. Roenbaugh" wrote:

I need a random number generated in a UDF. I tried using
worksheetfunction.rand() without success. The number needs to be
uniformly distributed between 0 and 1. Any ideas?

Thanks

Chris Roenbaugh




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default Random Number in VBA

tHANKS

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
Addding a Random number to a fixed number..... Dermot Excel Discussion (Misc queries) 6 August 20th 06 12:17 PM
How can I match a random number with closest number from sequence? Matt Excel Worksheet Functions 4 August 3rd 06 01:22 AM
same number appears in a random number generator Carmel Excel Worksheet Functions 4 May 28th 06 12:22 AM
Generating (in a random order)each number once from a given number Neil Goldwasser Excel Worksheet Functions 2 December 2nd 05 11:27 PM
How do I find random number in list of random alpha? (Position is. jlahealth-partners Excel Discussion (Misc queries) 0 February 8th 05 05:31 PM


All times are GMT +1. The time now is 10:39 AM.

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

About Us

"It's about Microsoft Excel"