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

Creating a macro - Writing a Script - Using the API

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

Postby Arun P. Pai » Wed Jul 04, 2018 5:08 am

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
Arun P. Pai
 
Posts: 13
Joined: Thu Apr 26, 2018 7:53 am

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

Postby Zizi64 » Wed Jul 04, 2018 6:17 am

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; LO4.4.7, LO6.1.5 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.2; AOO4.1.5
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.
User avatar
Zizi64
Volunteer
 
Posts: 7910
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

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

Postby Arun P. Pai » Wed Jul 04, 2018 1:35 pm

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
Arun P. Pai
 
Posts: 13
Joined: Thu Apr 26, 2018 7:53 am

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

Postby UnklDonald418 » Wed Jul 04, 2018 4:11 pm

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/so7/817-1826/817-1826.pdf
https://www.openoffice.org/api/basic/man/tutorial/tutorial.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.6 & LibreOffice 6.1.5.2 - Windows 10 Professional
UnklDonald418
Volunteer
 
Posts: 1122
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

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

Postby Zizi64 » Thu Jul 05, 2018 6:45 am

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:
https://forum.openoffice.org/en/forum/v ... 20&t=10817
https://forum.openoffice.org/en/forum/v ... 20&t=67946
https://forum.openoffice.org/en/forum/v ... 20&t=90758


https://ask.libreoffice.org/en/question ... matically/
Tibor Kovacs, Hungary; LO4.4.7, LO6.1.5 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.2; AOO4.1.5
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.
User avatar
Zizi64
Volunteer
 
Posts: 7910
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 5 guests