Ask Your Question

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

asked 2019-10-04 09:08:10 +0200

lonk gravatar image

updated 2019-10-04 09:15:08 +0200

image description

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

REM  *****  BASIC  *****
Sub Main
End Sub
Sub GetAddressOfLastCellUsed
   Dim oSheet As Object
   oSheet= thiscomponent.getcurrentcontroller.activesheet
   oCursor= oSheet.createCursor
   LastColumn= oCursor.RangeAddress.EndColumn
   LastRow= oCursor.RangeAddress.EndRow
   MSgBox "Cell name at the end of used area is " & LastColumn & LastRow+1 & "."
End Sub
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-10-04 21:15:01 +0200

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.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-10-04 09:08:10 +0200

Seen: 33 times

Last updated: Oct 04