vbabasiclibreoffice-calclibreoffice-basicopenoffice-basic

Libreoffice How to convert Cell.CellAddress.Row (is a number already) to an interger?


I would like to create a String for a CellRange and for that I have a RowNumber, but struggle to append it to a String
The 1st two lines of code are only for clarification, that you know which datatype Cell has

CellRange = sheetb.getCellByPosition(nColumn, i)  
Cell = CellRange.findFirst(Descript)




Dim subStrRan As string
subStrRan = "B1:B"
subStrRan = subStrRan + Cell.CellAddress.Row
print subStrRan  

When I run it, it tells me that the two datatypes of my concatenation (line 5) are incompatible - is there a way to cast it to the right datatype?


Solution

  • Use subStrRan = subStrRan & Cell.CellAddress.Row.

    + operator should not be used for concatenation. See this post for details.