Hi Friends,
I am getting error message while running macro in LibreOffice Calc. But, I am getting results in VBA.
Find the below screen shots.
Data
Original Macro Code Of VBA
and the Result Of VBA Code
LibreOffice Macro Code With Error Message
LibreOffice Code
Sub FilmLength_Convert_MinsToHrs
Dim Mins As Variant
Dim i As Integer
Dim Doc As Object, Sheet As Object, Cell As Object, Cursor As Object
Doc = ThisComponent : Sheet = Doc.Sheets(0)
Cell = Sheet.getCellRangeByName("B2")
Dim LastRow As Long
Cursor = Sheet.createCursorByRange(Cell)
Cursor.collapseToCurrentRegion
LastRow = Cursor.Rows.Count
ReDim Mins(LastRow-1)
Print LBound(Mins)+1
Print UBound(Mins)
For i = LBound(Mins)+1 To UBound(Mins)
Mins(i)(0) = MinsToHours(Mins(i)(0).Value)
Next i
Cell = getCellRangeByName("C2")
Cursor = Sheet.createCursorByRange(Cell)
Cursor.collapseToResize(1, LastRow-1).String = setDataArray(Mins)
End Sub
Function MinsToHours(ByVal m As Integer) As String
MinsToHours = Int(m / 60) & "h" & (m Mod 60) & "m"
End Function
Can anyone help me to get the correct code and where i made mistake ?