Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Set a column of 20 random numbers starting at A1. Convert these numbers into val

ID: 3688016 • Letter: S

Question

Set a column of 20 random numbers starting at A1. Convert these numbers into values by selecting them and then making the menu selections on the Home tab: COPY, PASTE , PASTE SPECIAL, VALUES. Save this data as a comma-delimited file called Random.csv. Write a VBA program that accomplishes the following:

1.- Uses the GetOpenFilename method to allow the user to select the file name and path

2.-Reads the numbers into an array

3.-Sorts the array in ascending order using the bubble sort (flowchart is shown below)

4.- Writes the sorted array to another worksheet and to a data file called Random.out

Explanation / Answer

Vba bubble sort elements: Function BubbleSortarray(TemporaryArray As Variant) Dim Temp As Variant Dim i As Integer Dim NoExchangeshere As Integer ' create a loop until no more exchanges are made. Do NoExchangeshere = True 'we will loop through each and every element in the array. For i = 1 To UBound(TemporaryArray) - 1 ' Now If the element is smaller than the element ' following it, exchange the two elements.This is done to arrange the array in ascending order If TemporaryArray(i)
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote