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

Could you please help me with this Excel Visual Basic Please make sure you did t

ID: 3818039 • Letter: C

Question

Could you please help me with this Excel Visual Basic

Please make sure you did the problem correctly

Problem 8

1. Write a macro that copies all string values in cells (ie, skip numbers) in theSelection to the 1st column of the spreadsheet in reverse order. As in many of the previous macros, you should use a For Each loop to walk through the selection.

2. Test your function using the Selection with multiple rows and columns.

3. Once you have tested your macro, iconify the Visual Basic window, and on a sheet of paper, re-write this macro by hand.

4. Bring the Visual Basic window back up and compare your work. Mark on your sheet of paper anything that you did wrong.

Explanation / Answer

steps :

1) Press alt+f11 to open vba window

2) click on insert tab and select module

3) copy and paste below code


Sub FlipCells() 'macro to reverse the order of the data
Dim Rng As Range
Dim WorkRng As Range
Dim data As Variant
Dim i As Integer, j As Integer, k As Integer
On Error Resume Next
xTitleId = "Excel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
data = WorkRng.Formula
For j = 1 To UBound(data, 2)
k = UBound(data, 1)
For i = 1 To UBound(data, 1) / 2
xTemp = data(i, j)
data(i, j) = data(k, j)
data(k, j) = xTemp
k = k - 1
Next
Next

WorkRng.Formula = data
End Sub

4) select the data that you want to reverse in excel

5) in the module class press f5

6) see your data.

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