• Home
  • About

Entries RSS | Comments RSS
  • Beginning PivotTables in Excel 2007 will introduce you to the exciting new pivot table features in Excel 2007. Create quick summaries and pivot charts, add impact with traffic light icons, design calculated fields, group dates and numbers.

  • Categories

  • Archives

  • Recent Posts

    • Enter Excel Data Without Decimals
    • Entering Dates and Times in Excel
    • Working With Dates In Excel
    • Avoiding Shared Workbooks in Excel
    • David McRitchie’s Excel Pages
  • Pages

    • About
  • Subscribe in a reader

Generate Numbers for Excel Testing

Posted on August 19th, 2008 by Debra Dalgleish

When answering newsgroup Excel questions, or doing testing for client projects, I often create a quick table, with a few rows and columns. The headings, such as a list of months or weekdays can be generated by using AutoFill. That just leaves the body of the table, where I want some numbers for the test.

I used to calculate numbers with a RAND or RANDBETWEEN formula, then copy and paste the results as values. But that’s a lot of steps when you’re in a hurry, so I built my own number generator, that runs with a click or two. The values aren’t important, I just want something to populate a table, pivot table or quick chart.

I wrote macros to generate numbers in different ranges, and added these to a toolbar menu. You could add toolbar buttons, or assign shortcut keys to run them. In Excel 2007, add them to the Quick Access Toolbar.

My macro code is shown below. Do you have a different way to create dummy numbers for testing?

‘====================================
Sub SRandRange()
Dim c As Range
Dim x As Long, y As Long
Application.EnableEvents = False
Application.ScreenUpdating = False

x = Application.InputBox(”Start Number”)
y = Application.InputBox(”End Number”)

For Each c In Selection
c.Value = randbetween(x, y)
Next

Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
‘====================================
Sub SRand10()
Dim c As Range
Application.EnableEvents = False
Application.ScreenUpdating = False

For Each c In Selection
c.Value = Evaluate(”=ROUND(RAND()*10,0)”)
Next c

Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
‘====================================

Share/Save/Bookmark

Filed under: Excel

« Excel Fashion Statement Add Links to the Windows Taskbar »

One Response to “Generate Numbers for Excel Testing”


  1. Pingback from Recent Links Tagged With “newsgroup” - JabberTags
    Time: September 7, 2008, 7:34 am

    [...] public links >> newsgroup Generate Numbers for Excel Testing Saved by sweetprincess137 on Sun [...]

Leave a Reply

  • Subscribe

    Subscribe in a reader
  • Email Updates

    Subscribe by Email
  • Calendar

    August 2008
    S M T W T F S
    « Jul   Sep »
     12
    3456789
    10111213141516
    17181920212223
    24252627282930
    31  
  • Contextures

    • Contextures Excel Pages
    • My Video Tutorials
  • Excel

    • Daily Dose of Excel
    • Excel Team Blog
    • Jan Karel Pieterse
    • JP’s Excel/Outlook
    • PTS Blog
    • Spreadsheet Page Blog
    • TVMCalcs Excel Blog
  • General

    • Hodge Blog
    • J-Walk Blog
    • SuiteMinute