How to create 700 random numbers in a range in three Excel columns

I need to learn how to populate a new, empty Excel 2010 spreadsheet properly.  I need three columns of 12 digit integers, with each column having 700 such numbers in a range I will specify.   Please start with the basics, because I'm not getting anywhere with all my "trial and error".  TIA
LVL 3
sasllcAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
Sub GenerateRandom()
Dim intCol As Integer
Dim intRow As Integer

Randomize

Application.ScreenUpdating = False

For intCol = 1 To 3
    For intRow = 1 To 700
        Cells(intRow, intCol) = WorksheetFunction.RandBetween(1, 200)
    Next
Next

Application.ScreenUpdating = True
End Sub

Open in new window

0
Martin LissOlder than dirtCommented:
Oh, sorry, I didn't notice that you need 12-digit numbers. Be back soon.
0
Martin LissOlder than dirtCommented:
Sub GenerateRandom()
Dim intCol As Integer
Dim intRow As Integer

Randomize

Application.ScreenUpdating = False

For intCol = 1 To 3
    For intRow = 1 To 700
        Cells(intRow, intCol) = WorksheetFunction.RandBetween(100000000000#, 999999999999#)
    Next
Next

Application.ScreenUpdating = True
End Sub

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

sasllcAuthor Commented:
Can I somehow put this code into my excel spreadsheet?  If so, how and where do I do so?  Or will I need to write a vb app to do this?
0
Martin LissOlder than dirtCommented:
As a formula you can do

= RANDBETWEEN(100000000000, 999999999999)
0
Martin LissOlder than dirtCommented:
will I need to write a vb app to do this?
What i provided in post ID: 42406146 was a Sub that you can execute from within Excel, and here's how.

In Excel, Press Alt+F11 to open the Visual Basic Editor (VBE)

Right-click on your workbook name in the "Project-VBAProject" pane (at the top left corner of the editor window). If you don’t see an existing module then select Insert -> Module from the context menu. Otherwise just select the module.

Copy the macro (you can use the ‘Select All’ button if you like) and paste it into the right-hand pane of the VBA editor ("Module1" window)

Press Alt+F11 again to go back to Excel

Optionally, press Alt+F8 to open the "Macro" dialog window. Select the macro, click ‘Options…’,  hold down the Shift key and type the letter A (or any other letter) and click ‘OK’. Then anytime you want to run the macro press Ctrl+Shift+A.

When you close the workbook you will need to save it as an xlsm or xls file if it’s not already one of those.
0
sasllcAuthor Commented:
I am using Excel 2010.  When I press Alt-F11 or Alt-F8, it just makes a "bing" tone but goes nowhere.  The screen does not change.  Any ideas?
0
sasllcAuthor Commented:
Ignore the last question...I found that solution.
0
Martin LissOlder than dirtCommented:
Did my code work for you?
0
sasllcAuthor Commented:
I will be testing it tonight.
0
sasllcAuthor Commented:
Worked great, thank you.
0
Martin LissOlder than dirtCommented:
You’re welcome and I’m glad I was able to help.

If you expand the “Full Biography” section of my profile you’ll find links to some articles I’ve written that may interest you.

Marty - Microsoft MVP 2009 to 2017
              Experts Exchange MVE 2015
              Experts Exchange Top Expert Visual Basic Classic 2012 to 2017
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.