+ Reply to Thread
Results 1 to 5 of 5

possible until 5461

  1. #1
    tom taol
    Guest

    possible until 5461


    sub ex()
    n = 5462

    ReDim aRnd(1 To n)
    ReDim uniq(1 To n)

    For i = 1 To n: aRnd(i) = i: Next

    For i = n To 2 Step -1
    k = Int(Rnd * i) + 1
    n_cnt = n_cnt + 1
    uniq(n_cnt) = aRnd(k)
    aRnd(k) = aRnd(i)
    Next

    uniq(n) = aRnd(1)
    Range("b1:b" & n).Value = Application.Transpose(uniq)
    end sub

    why error?

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

  2. #2
    RB Smissaert
    Guest

    Re: possible until 5461

    This is a known limitation.
    Go to this website:
    http://home.pacbell.net/beban/
    Download the arrayfunctions and use the function ArrayTranspose for this
    purpose.

    RBS


    "tom taol" <[email protected]> wrote in message
    news:[email protected]...
    >
    > sub ex()
    > n = 5462
    >
    > ReDim aRnd(1 To n)
    > ReDim uniq(1 To n)
    >
    > For i = 1 To n: aRnd(i) = i: Next
    >
    > For i = n To 2 Step -1
    > k = Int(Rnd * i) + 1
    > n_cnt = n_cnt + 1
    > uniq(n_cnt) = aRnd(k)
    > aRnd(k) = aRnd(i)
    > Next
    >
    > uniq(n) = aRnd(1)
    > Range("b1:b" & n).Value = Application.Transpose(uniq)
    > end sub
    >
    > why error?
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!



  3. #3
    tom taol
    Guest

    Re: possible until 5461



    very thank you !!!
    happy to you

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

  4. #4
    Tom Ogilvy
    Guest

    Re: possible until 5461

    Faster and simpler than transposing or using Alan's code would be

    sub ex()
    n = 5462

    ReDim aRnd(1 To n)
    ReDim uniq(1 To n, 1 to 1)

    For i = 1 To n: aRnd(i) = i: Next

    For i = n To 2 Step -1
    k = Int(Rnd * i) + 1
    n_cnt = n_cnt + 1
    uniq(n_cnt,1) = aRnd(k)
    aRnd(k) = aRnd(i)
    Next

    uniq(n,1) = aRnd(1)
    Range("b1:b" & n).Value = uniq
    end sub

    --
    Regards,
    Tom Ogilvy


    "tom taol" <[email protected]> wrote in message
    news:[email protected]...
    >
    >
    > very thank you !!!
    > happy to you
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    > Don't just participate in USENET...get rewarded for it!




  5. #5
    tom taol
    Guest

    Re: possible until 5461



    thank you(tom) very much.
    i knew the reason for your help.

    *** Sent via Developersdex http://www.developersdex.com ***
    Don't just participate in USENET...get rewarded for it!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1