Question: Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it to a size equal to an assigned value of
Microsoft Excel VBA (Visual Basic for Applications) Programming Language
Objectives: Create an array and redim it to a size equal to an assigned value of a variable, populate the array with a series of random numbers, output the array to a message box and to a worksheet.
Option Explicit Option Base 1
' ******** DSS 620 TEMPLATE ---- Created by John A. Michl jmichl@sju.edu ******** ' ** ' ** Module 4 Exercise 2 ' ** Template Revision: 01/12/2018 v1.1 by John A. Michl ' ** Note: Professor's comments preceeded by '[ ' ** Instructions / hints preceeded by '>> ' ** Student comments should use apostrophe only ' ** ' ** Assignment modified by STUDENT NAME on DATE ' ** ' ******************************************************************************
Sub RandomList()
' all variables needed for Part A have been declared
Dim i As Integer ' number of random numbers to make Dim intRandom As Integer ' number of random numbers to make Dim arrRandom() As Single ' array in which to store numbers Dim strMsg As String Dim strTitle As String Randomize ' this initializes the random number generator Debug.Print Rnd ' just to show how easy it is to create a Worksheets("Output").Range("A:B").Clear ' remove old results ']vvvvv Student code below vvvvvv '] assign a value to intRandom '] redim the array to be the appropriate size '] fill the array with random numbers using a loop '] create the list of numbers for the message string using a loop '] be sure to include both the index value i and the contents of the array
'] create the message title to show the random number in position 6 of the array '] see the screen shot but note the random numbers will be different '] display the message box '] output the array to the output worksheet showing the index number in '] column A and the random number in column B
'^^^^ Student code above
End Sub
____________________________________________________________________
The message box should look something like the following:

Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
