Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I want to create a vba code that bubble sorts sorts a 2d excell spreadsheet consisting of a 20 row by 10 column array. I

I want to create a vba code that bubble sorts sorts a 2d excell spreadsheet consisting of a 20 row by 10 column array. I have attached a image of my code for a 1D array bubble sort. I just have trouble applying this to 2 dimensionsimage text in transcribed

image text in transcribed

Vbubblesort Sub bubblesort() Dim temp As Double Dim i As Integer Dim k As Integer Dim rowsnumb As Integer For k 1 To rowsnumb- 1 Do Until i = rowsnumb-k + 1 If ActiveSheet.Cells (i, 1) .Value > ActiveSheet.Cells (i +1, 1).Value Then temp ActiveSheet.Cells (i, 1). Value Activesheet.Cells (i, 1).Value ActiveSheet.Cells(i ActiveSheet.Cells (i + 1, 1) .Value temp 1, 1).Value End If Loop Next End Sub Vbubblesort Sub bubblesort() Dim temp As Double Dim i As Integer Dim k As Integer Dim rowsnumb As Integer For k 1 To rowsnumb- 1 Do Until i = rowsnumb-k + 1 If ActiveSheet.Cells (i, 1) .Value > ActiveSheet.Cells (i +1, 1).Value Then temp ActiveSheet.Cells (i, 1). Value Activesheet.Cells (i, 1).Value ActiveSheet.Cells(i ActiveSheet.Cells (i + 1, 1) .Value temp 1, 1).Value End If Loop Next End Sub

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

ISBN: 1285427106, 978-1285427102

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago