LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Random numbers not using randbetween()


Hi everyone,
I have been trying repeatedly for days now to write a macro to generat
random numbers. I need to generate 23 unique numbers in 5 columns.
have found a macro that can do one column at a time but i cannot modif
this to work over the five columns.

Here is the code for you to look at:

Sub CreateRand()
Dim Nums(23)
Dim I As Integer
Dim X As Integer
Dim rng As Range
Dim c As Range
Dim Filled As Boolean

For I = 1 To 23
Nums(I) = I
Next I

Set rng = Range("f1:f23")

For Each c In rng

Do

X = Int((Rnd * 23) + 1)
If Nums(X) < 0 Then
c.Value = Nums(X)
Nums(X) = 0
Filled = True
End If
Loop Until Filled
Filled = False
Next c
End Sub
All help will be greatly received!!!!!!


Thanks, a slowly going bald Excel use

--
davehill197
-----------------------------------------------------------------------
davehill1974's Profile: http://www.excelforum.com/member.php...fo&userid=2499
View this thread: http://www.excelforum.com/showthread.php?threadid=38521

 
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
How to keep random number from changing using RANDBETWEEN? TXlimogirl Excel Worksheet Functions 6 April 3rd 23 04:41 PM
RANDBETWEEN generating numbers outside range Penny Black Excel Worksheet Functions 5 May 25th 10 10:14 PM
how can I use randbetween without repeating numbers in a set Maria Excel Worksheet Functions 7 October 30th 09 06:19 AM
Non-random numbers generated by excel's data analysis random gener Allie Excel Worksheet Functions 10 September 17th 05 06:19 AM
Non-random numbers generated by excel's data analysis random gener Harlan Grove Excel Discussion (Misc queries) 2 September 13th 05 04:06 PM


All times are GMT +1. The time now is 02:03 PM.

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"