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 function in MS excel returns the random number generated between two specified ranges.

Format:

As VBA Function : Int((Max – Min + 1) * Rnd + Min)

Arguments:
  • Max and Min
    • Mandatory
    • Type: Numbers
    • Random number gets generated between these two numbers (Max – the highest value the random number can be. Min – The smallest value the random number can be)

Example:

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: