LibreOffice Calc opens the Statement Modified 2.xls Excel spreadsheet file (attachment in bug issue at tdf#149325). LibreOffice Calc runs the VBA macro without crashing when the “Generate Statement” button is clicked in the “Range” sheet.
The Sort function works in MS Excel, but not LO Calc. The MS Excel VBA sort code is shown below:
Private Sub SortData(intSheetIndex As Integer)
' Works with Microsoft Excel, not LibreOffice Calc
With Worksheets(intSheetIndex)
.Range("A1").Sort _
Key1:=.Columns("A"), _
Order1:=xlAscending, _
Header:=xlYes, _
MatchCase:=False, _
Orientation:=xlTopToBottom
End With
' Enums
' xlAscending : 1
' xlYes : 1
' False : 0 (guess)
' xlTopToBottom : 1
End Sub
Eike Rathke kindly advised the location of ScVbaRange::Sort(), i.e.
https://opengrok.libreoffice.org/xref/core/sc/source/ui/vba/vbarange.cxx?r=d6331fc7#3411
How can the MS Excel VBA sort code be rewritten so that it works with both MS Excel and LO Calc?
Thank you