[Solved] How to get the row number of the last row

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
Arun P. Pai
Posts: 15
Joined: Thu Apr 26, 2018 7:53 am

[Solved] How to get the row number of the last row

Post by Arun P. Pai »

Dear Friends,

I am putting an all out effort to learn OOo BASIC.

I have written a lot of code in MS EXCEL VBA, but struggling to get it into OOo.

Please give the equivalent code of [This code is used extensively by me in MS EXCEL VBA]
LstRw = Sheets(i).Cells(Cells.Rows.Count, "a").End(xlUp).Row
LstRw is a variable.
In this case Column A is being searched for the value.

Sorry for the trouble.

Thank you in advance.

Arun.
Last edited by Arun P. Pai on Thu Jul 05, 2018 5:33 am, edited 1 time in total.
Arun
OS - Windows 8.1
Open Office 4.1.5
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: How to get the row number of the last row in a block of

Post by Zizi64 »

I am putting an all out effort to learn OOo BASIC.
That will not be enough. You must study the API functions first. (API: Application Programming Interface)
The name of the built-in IDE and programming language of the Apache openoffice and Libreoffice is the "StarBasic" (or simpls: "Basic"). It is a very simple programming language with a few commands only.

You can control the applications and the documents by calling the API functions from your basic code. You can call the API functions from all of the supported programing languages and environments.

In other words: The API functions are independent from the Basic.

Plese download and study Andrew Pitonyak's free macro programming books:
http://www.pitonyak.org/oo.php
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Arun P. Pai
Posts: 15
Joined: Thu Apr 26, 2018 7:53 am

[Solved] How to get the row number of the last row in......

Post by Arun P. Pai »

Dear Friend,
Plese download and study Andrew Pitonyak's free macro programming books:
Okay will read the relevant chapter in the book referred by you, and try to understand.

Thank You very much for your advice.

Arun.
Arun
OS - Windows 8.1
Open Office 4.1.5
UnklDonald418
Volunteer
Posts: 1546
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: How to get the row number of the last row in a block of

Post by UnklDonald418 »

If you want to use the OpenOffice IDE (debugger) then you will need to use Star Basic. Andrew Pitonyak has good coverage in his book "OpenOffice.org Macros Explained" but these links can also prove helpful
https://docs.oracle.com/cd/E19064-01/so ... 7-1826.pdf
https://www.openoffice.org/api/basic/ma ... torial.pdf

If you are going to write code to access the API then you will need an object inspection tool
[Tutorial] Introduction into object inspection with MRI

Your VBA code isn't very meaningful here, but you might find some answers looking at Chapters 6.22 and 6.23 of Andrew Pitonyak's document "Useful Macro Information".

As you are learning the OpenOffice API is complex. It is better to learn to use the numerous features of the OpenOffice modules and rely on macro coding as a last resort.
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
User avatar
Zizi64
Volunteer
Posts: 11358
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: [Solved] How to get the row number of the last row

Post by Zizi64 »

How to get the row number of the last row in a block of
Please do not write the main question into the title (only), because it will be truncated...


The number of the last row in an .ods document (if you are using a recent version of the AOO or LO) is 1,048,576 = 2^20.
https://wiki.documentfoundation.org/Faq/Calc/022

I suppose you want to get the number of the last USED (non empty) row in a column... Im I right?

Here are some similar topics:
viewtopic.php?f=20&t=10817
viewtopic.php?f=20&t=67946
viewtopic.php?f=20&t=90758


https://ask.libreoffice.org/en/question ... matically/
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
Post Reply