Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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" wrote in message ... 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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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" wrote in message ... very thank you !!! happy to you *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Thread Tools | Search this Thread |
Display Modes | |
|
|