Thread: Random Numbers
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Jarek Kujawa[_2_] Jarek Kujawa[_2_] is offline
external usenet poster
 
Posts: 896
Default Random Numbers

having re-read the conditions I have to agree with Jim
they are to strict
are you trying to populate C3:L3 AND B4:B13 with random integers
ranging from 0 to 9?
if so I cannot provide a solution
or you meant to populate both ranges SEPARATELY?


On 16 Maj, 07:41, robert morris
wrote:
Jarek,

Thanks, your Code works perfectly for the Column B but does not address Row 3.

Bob



"Jarek Kujawa" wrote:
would this macro help?


Sub cus()
Dim cell As Range


With Range("B4:B13")
..Clear
Â* Â* For Each cell In .Cells
repeat:
Â* Â* k = WorksheetFunction.RandBetween(0, 9)
Â* Â* Â* Â* If WorksheetFunction.CountIf(.Cells, k) = 0 Then
Â* Â* Â* Â* Â* Â* cell = k
Â* Â* Â* Â* Else
Â* Â* Â* Â* Â* Â* GoTo repeat
Â* Â* Â* Â* End If
Â* Â* Next
End With
End Sub


On 16 Maj, 05:47, robert morris
wrote:
I need help with a VBA for creating NON-REPEATING random numbers between 0-9
in Col B4:B13 and Row C3:L3


Bob- Ukryj cytowany tekst -


- Pokaż cytowany tekst -