Page 198 - Computer - 10(A&B)
P. 198
Step 1: Create a new Calc workbook and enter some data with Name and Total Marks of students as
shown below.
Step 2: Now, go to the Basic window and create the following code.
Here, an array of sort fields determines the columns that are sorted. This is an array with two
elements, 0 and 1.
To sort only one column, use:Dim oSortFields(1) As New com.sun.star.util.SortField
The columns are numbered starting with 0, so column A is 0, column B is 1, etc. We will Sort
column B (column 1) descending. If column B has two cells with the same value, then use column
A to decide the order.
Step 3: Now, go back to the Calc workbook and run this macro.
The result will be:
80