UrbanPro
true

Learn Microsoft Excel Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

VBA Tip: Print Random Numbers In A Selected Range

Karthik Dale
25/07/2017 0 0

Let’s say you want to print some random numbers in a selected range then you can use below Macro.

Sub Print_Randomnumbers()

Dim myrng As Range

For Each myrng In Selection

    myrng.Value = Application.WorksheetFunction.Int(Rnd * 1000)

Next myrng

End Sub

How it works?

  1. It's a for each loop which loops through each cell in the selection.
  2. VBA function Rnd populate random number from 0 to 1.
  3. If you want to print numbers up to the range of 1000 then multiply Rnd with 1000.
  4. . Int function pulls the integer value from Rnd*1000.

 

0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You


Advanced Excel and VBA concept
In this video, learn about Advanced Excel: - Data Input and Hidden Features, - Worksheet Navigation, - Excel Formulas & Functions, - Data Cleaning and Formatting. VBA and its useful Built-in Functions,...

Nagadarshan

0 0
0

Data Analysis with MS Excel Filter - Top Performers, Bottom Performers, Above Average Performers, Below Average Performers!
In the following, You would find lesser-known, unexplored yet Powerful Features of Filter. Please refer to sample dataset below: To do Data Analysis:Step 1) Apply Filter on the dataset.Step 2) In Sales...

HERE TODAY WE WILL USE THE SUMIFS FUNCTION.
A B C D 1 NAME PRODUCT NAME TOTAL AMOUNT 2 SAURABH WASHING MACHINE 4165 3 MANIPAL MI PHONE 4803 4 ANJALI SAMSUNG MOBILE 4610 5 UMA NOKIA PHONE 4441 6 SHANKER T.V 3765 7 NARESH ...

Data Validation In Excel
MS Excel data validation feature allows you to set up certain rules that dictate what can be entered into a cell. For example, you may want to limit data entry in a particular cell to whole numbers between...
X

Looking for Microsoft Excel Training Classes?

The best tutors for Microsoft Excel Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Microsoft Excel Training with the Best Tutors

The best Tutors for Microsoft Excel Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more