Hi Giorgio,

Looks like the issue was here:

*Function RandLotto(Bottom As Integer, Top As Integer, _

                    Amount As Integer) As String*

*
*

*When you copy paste the above it does not work.*

*
*

*Please replace the above lines with:*

*Function RandLotto(Bottom As Integer, Top As Integer, Amount As
Integer) As String*

It should work fine now

Cheers
Andy

On Sat, Sep 18, 2010 at 10:55 AM, Aindril De <aind...@gmail.com> wrote:

> Hi Giorgio,
>
> Use the following UDF.
>
> *Function RandLotto(Bottom As Integer, Top As Integer, _
>
>                     Amount As Integer) As String*
>
>     Dim iArr As Variant
>
>     Dim i As Integer
>
>     Dim r As Integer
>
>     Dim temp As Integer
>
>
>
>     Application.Volatile
>
>
>
>     ReDim iArr(Bottom To Top)
>
>     For i = Bottom To Top
>
>         iArr(i) = i
>
>     Next i
>
>
>
>     For i = Top To Bottom + 1 Step -1
>
>         r = Int(Rnd() * (i - Bottom + 1)) + Bottom
>
>         temp = iArr(r)
>
>         iArr(r) = iArr(i)
>
>         iArr(i) = temp
>
>     Next i
>
>
>
>     For i = Bottom To Bottom + Amount - 1
>
>         RandLotto = RandLotto & " " & iArr(i)
>
>     Next i
>
>
>
>     RandLotto = Trim(RandLotto)
>
>
> *End Function*
>
>
> To use this UDF push *Alt*+*F11* and go *Insert*>*Module* and paste in the
> code. Push *Alt*+*Q* and save. The Function will appear under "*User
> Defined*" in the Paste Function dialog box (*Shift*+*F3*). Use the
> Function in any cell as shown below.
>
> *=RandLotto(1,20,8)*
> This would produce 8 unique random numbers between 1 and 20
>
> For further details you can visit the following link:
>
> http://www.ozgrid.com/VBA/RandomNumbers.htm
>
>
> Regards,
> Andy
>
>
> On Thu, Sep 16, 2010 at 7:07 PM, Giorgio <giorgioros...@gmail.com> wrote:
>
>> All,
>> I need to build an excel that generates X unique series of 5 random
>> numbers, lottery style (no repetition in the same series and no
>> repetition across the series).
>> I know the function RANDBETWEEN, but how can I include the "no
>> repetition"?
>>
>> Thank you,
>> G
>>
>> --
>>
>> ----------------------------------------------------------------------------------
>> Some important links for excel users:
>> 1. Follow us on TWITTER for tips tricks and links :
>> http://twitter.com/exceldailytip
>> 2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
>> 3. Excel tutorials at http://www.excel-macros.blogspot.com
>> 4. Learn VBA Macros at http://www.quickvba.blogspot.com
>> 5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
>>
>> To post to this group, send email to excel-macros@googlegroups.com
>>
>> <><><><><><><><><><><><><><><><><><><><><><>
>> HELP US GROW !!
>>
>> We reach over 7000 subscribers worldwide and receive many nice notes about
>> the learning and support from the group.Let friends and co-workers know they
>> can subscribe to group at
>> http://groups.google.com/group/excel-macros/subscribe
>>
>
>

-- 
----------------------------------------------------------------------------------
Some important links for excel users:
1. Follow us on TWITTER for tips tricks and links : 
http://twitter.com/exceldailytip
2. Join our LinkedIN group @ http://www.linkedin.com/groups?gid=1871310
3. Excel tutorials at http://www.excel-macros.blogspot.com
4. Learn VBA Macros at http://www.quickvba.blogspot.com
5. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 
To post to this group, send email to excel-macros@googlegroups.com

<><><><><><><><><><><><><><><><><><><><><><>
HELP US GROW !!

We reach over 7000 subscribers worldwide and receive many nice notes about the 
learning and support from the group.Let friends and co-workers know they can 
subscribe to group at http://groups.google.com/group/excel-macros/subscribe

Reply via email to