• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Rnd and RAND()

How is the answer I provided you not what you are asking for here.

 
How is the answer I provided you not what you are asking for here.



Rnd() in VBA only has a short period of 2^24
 
But you are not looking for anything in either that have anything to do with Rnd(). You really are confusing me.
 
Did you look at the code I provided you in the other thread. Did you test it? I used RandBetween not Rand. Lets you select the range of numbers you wish to see. The Rand() presents not an integer but decimal value. Is that what you are looking for? Or an integer?
 
Did you look at the code I provided you in the other thread. Did you test it? I used RandBetween not Rand. Lets you select the range of numbers you wish to see. The Rand() presents not an integer but decimal value. Is that what you are looking for? Or an integer?

I am looking for random numbers with decimal value.
 
You know, it helps to be specific in your request from the beginning. It is difficult to read one's mind from this side of the computer. Anyway, I am patient. Try this code on for size.

Code:
Option Explicit


Sub Random()
    Dim x As Long
    Dim rn As Long
    Dim cn As String
    Dim sn As Long
    Dim en As Long
    cn = InputBox("Which Column to fill?")
    rn = InputBox("How many rows to fill?")
    

    Application.ScreenUpdating = False
    x = 1
    Range(cn & "1").Select
    Do Until ActiveCell.Row = rn
        If ActiveCell.EntireRow.Hidden = False Then
            Debug.Print
            ActiveCell.Formula = WorksheetFunction.RandArray
            x = x + 1
        End If
        ActiveCell.Offset(1).Select
    Loop
    
    Application.ScreenUpdating = True
End Sub
 
You know, it helps to be specific in your request from the beginning. It is difficult to read one's mind from this side of the computer. Anyway, I am patient. Try this code on for size.

Code:
Option Explicit


Sub Random()
    Dim x As Long
    Dim rn As Long
    Dim cn As String
    Dim sn As Long
    Dim en As Long
    cn = InputBox("Which Column to fill?")
    rn = InputBox("How many rows to fill?")
   

    Application.ScreenUpdating = False
    x = 1
    Range(cn & "1").Select
    Do Until ActiveCell.Row = rn
        If ActiveCell.EntireRow.Hidden = False Then
            Debug.Print
            ActiveCell.Formula = WorksheetFunction.RandArray
            x = x + 1
        End If
        ActiveCell.Offset(1).Select
    Loop
   
    Application.ScreenUpdating = True
End Sub

Thank you very much !

Cheers
 
Back
Top