Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Contact us
Hide Buttons

Excel-VBA: Math Functions – RND()

Description: 

The RND func­tion in MS excel returns the ran­dom num­ber gen­er­ated between two spec­i­fied ranges.

Format:

As VBA Func­tion : Int((Max — Min + 1) * Rnd + Min)

Arguments:
  • Max and Min
    • Manda­tory
    • Type: Num­bers
    • Ran­dom num­ber gets gen­er­ated between these two num­bers (Max — the high­est value the ran­dom num­ber can be. Min — The small­est value the ran­dom num­ber can be)

Exam­ple:

Function getRnd()

Dim Max

Dim Min

Max = 100

Min = 200

   strResult = "The Random number between " & Max & " And " & Min & " is " & Int((Max - Min + 1) * Rnd + Min) & vbCrLf

   strResult = strResult & "The Random number between " & Max & " And " & Min & " is " & Int((Max - Min + 1) * Rnd + Min)

MsgBox strResult

End Function
Rnd() - Functions

Rnd() — Functions

 

 

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: