How would I go about finding the last cell with data in a range and or a rangename?
My searches have been in vain.
Thanks
Finding last used cell in a range
Finding last used cell in a range
Open Office 4.1 on Windows 10
Re: finding last used cell in a range
Code: Select all
Function getUsedRange(oSheet)
Dim oRg
oRg = oSheet.createCursor()
oRg.gotoStartOfUsedArea(False)
oRg.gotoEndOfUsedArea(True)
getUsedRange = oRg
End Function
Function getCurrentRegion(oRange)
REM rectangle of adjacent non-empty cells
Dim oCursor
oCursor = oRange.getSpreadSheet.createCursorByRange(oRange)
oCursor.collapseToCurrentRegion
getCurrentRegion = oCursor
End Function
Function getMergedRegion(oRange):
REM Get merged range around given range.
Dim oCursor
oCursor = oRange.getSpreadsheet().createCursorByRange(oRange)
oCursor.collapseToMergedArea()
getMergedRegion = oCursor
End Function
Function getCurrentArray(oCell)
REM area of current array formula
Dim oCursor
oCursor = oCell.getSpreadSheet.createCursorByRange(oCell)
oCursor.collapseToCurrentArray
getCurrentArray = oCursor
End Function
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: finding last used cell in a range
Thanks however I pretty new at this, I don't quite know how to go about using this.
thanks
thanks
Open Office 4.1 on Windows 10
Re: finding last used cell in a range
Learn how to program.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: finding last used cell in a range
Whie I'm new to Open office, been programing for years in VBA. I'm just trying to convert a few VBA macros to Open office. Its not easy (in my eyes) to understand, things that take a couple of lines in VBA take about twenty.
Thanks again for Your time.
Thanks again for Your time.
Open Office 4.1 on Windows 10
Re: finding last used cell in a range
Andrew Pitonyak's books are the bibles for OO Macro Programming, downloadable from
Andrew Pitonyak's macro books
Andrew Pitonyak's macro books
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Re: finding last used cell in a range
Then you should know what a function does.Fraz627 wrote:Whie I'm new to Open office, been programing for years in VBA.
This is not VBA, not even close. The open source application provides very abstract, bare bone programming interfaces. There is almost no sugar coating but free choice between several programming languages.
This whole office suite is about as large as the VBA components in MS Office alone.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice