EXCEL VBA Write a program that asks the users to enter 5 num

EXCEL VBA

Write a program that asks the users to enter 5 numbers and then outputs these values in reverse order on a spreadsheet

Solution

Solution:

Sub FlipColumns()
\'Updateby20161122
Dim Rng As Range
Dim WorkRng As Range
Dim Arr As Variant
Dim i As Integer, j As Integer, k As Integer
On Error Resume Next
xTitleId = \"KutoolsforExcel\"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox(\"Range\", xTitleId, WorkRng.Address, Type:=8)
Arr = WorkRng.Formula
For j = 1 To UBound(Arr, 2)
k = UBound(Arr, 1)
For i = 1 To UBound(Arr, 1) / 2
xTemp = Arr(i, j)
Arr(i, j) = Arr(k, j)
Arr(k, j) = xTemp
k = k - 1
Next
Next
WorkRng.Formula = Arr
End Sub

EXCEL VBA Write a program that asks the users to enter 5 numbers and then outputs these values in reverse order on a spreadsheetSolutionSolution: Sub FlipColumn

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site