USE VBA Create a sub procedure that sorts a list of numbers

USE VBA

Create a sub procedure that sorts a list of numbers. Prompt the user to enter the range of numbers to sort. Use the Do While loop and If statement in your visual basic code. Do not use the sorting function of Excel.

Solution

this is a simple buuble sort code to sort the given \"n\" numbers by the user

program;-

Private Sub SortIntegerArray(paintArray() As Integer)

Dim lngX As Integer

Dim lngY As Integer

Dim n as Integer

Dim intTemp As Integer

n=InputBox(“enter the number of elements to be sorted”)

For lngX = 0 To n

For lngY = 0 To n

do

\' exchange the items

intTemp = paintArray(lngY)

paintArray(lngY) = paintArray(lngY + 1)

paintArray(lngY + 1) = intTemp

loop while paintArray(lngY) > paintArray(lngY + 1)

Next

Next

Loop

End Sub

USE VBA Create a sub procedure that sorts a list of numbers. Prompt the user to enter the range of numbers to sort. Use the Do While loop and If statement in yo

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site