Calc|BASIC : How to convert column index number to column name

image description

From the following code and result, how can I convert column index number ‘4’ to column name ‘E’?

REM  *****  BASIC  *****
Sub Main
	GetAddressOfLastCellUsed
End Sub
Sub GetAddressOfLastCellUsed
   Dim oSheet As Object
   oSheet= thiscomponent.getcurrentcontroller.activesheet
   oCursor= oSheet.createCursor
   oCursor.gotoEndOfUsedArea(False)
   LastColumn= oCursor.RangeAddress.EndColumn
   LastRow= oCursor.RangeAddress.EndRow
   MSgBox "Cell name at the end of used area is " & LastColumn & LastRow+1 & "."
End Sub

Hello @lonk

If you want to get cell name of the CellCursor object, you do not need to dig into Range Address properties. You can use oCursor.AbsoluteName property to get full name of the cell. You can also try oCursor.ColumnDescriptions or oCursor.Columns.ElementNames - depends on what you want to get in the end.