Dim xl as new ExcelApplication
xl.Workbooks.Add
xl.Visible = True
Dim r as new Random
Dim i as Integer
'Create 3 columns of random data
For i = 1 to 7
xl.Range("A"+ Cstr(i)).value = CStr(r.InRange(0,100))
xl.Range("B"+ Cstr(i)).value = CStr(r.InRange(0,100))
xl.Range("C"+ Cstr(i)).value = CStr(r.InRange(0,100))
Next i
MsgBox "Random numbers were created. Sorting will start"
'Sort
xl.Worksheets("sheet1").Range("A1:C7").sort(xl.Range("A1:C7"))
'Show any errors
exception err as NilObjectException
MsgBox err.Message
This example shows how to sort three side-by-side columns in Excel. Note: The MSOfficeAutomation.rbx plugin must be placed in the Xojo Plugins folder for this to work.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.