Bug 50846 - Macros: Wrong type of function GetLastUsedRow (standard library Tools, module Misc)
Summary: Macros: Wrong type of function GetLastUsedRow (standard library Tools, module...
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
(earliest affected)
3.5.3 release
Hardware: Other All
: medium normal
Assignee: Andreas Heinisch
Whiteboard: BSA target:6.4.0
Depends on:
Blocks: Macro-StarBasic
  Show dependency treegraph
Reported: 2012-06-07 09:31 UTC by Vladislav Orlov aka JohnSUN
Modified: 2019-09-29 08:38 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Note You need to log in before you can comment on or make changes to this bug.
Description Vladislav Orlov aka JohnSUN 2012-06-07 09:31:42 UTC
Problem description: 
The type is Integer,  should be Long
Steps to reproduce:
1. Put any value in any cell at line above 32769
2. Run a simple macro:
Sub testGetLastUsedRow()
	Print "Number of Last Used Row is " + GetLastUsedRow(ThisComponent.getCurrentController().getActiveSheet())
End Sub
3. Get error "Overflow"
Comment 1 Robinson Tryon (qubit) 2013-02-14 02:30:24 UTC
(Testing on Ubuntu 12.04.2, LO

Repro steps:

1. Open Calc
2. Move to cell A32770
3. Type "1", and press [Enter]
4. Tools -> Macros -> Organize Macros -> LibreOffice Basic
5. Select the current document (e.g. "Untitled 1") and then click "New"
6. Use the default "Module1" name for the module. Click "OK".
7. Click "Edit"
8. Press [Enter] twice to move down two lines.
9. Copy the macro as provided and paste it into the code window.
10. Press [F5] to run the macro

Immediately get error:

Inadmissible value or data type.

The error occurs on line 623 "	GetLastUsedRow = aAddress.EndRow" in "Function GetLastUsedRow(oSheet as Object) as Integer", which is located in the Object Catalog under LibreOffice Macros & Dialogs -> Tools -> Misc
Comment 2 bugquestcontri 2013-09-26 08:40:07 UTC
It is just a comment as I don't have the expertise to verify the reported bug.

JohnSUN is one of top contributors in AskLibO and there is no comment yet on a possible bug fix. Therefore I ask for a look into this bug report and try to find a solution.

(I am aware that we have only volunteers as devs and appreciate their work a lot!)
Comment 3 QA Administrators 2015-04-01 14:40:40 UTC Comment hidden (obsolete)
Comment 4 Buovjaga 2015-04-22 12:05:52 UTC

Win 7 Pro 64-bit Version: (x64)
Build ID: 211c12b9c64facd1c12f637a5229bd6a6feb032a
TinderBox: Win-x86_64@42, Branch:master, Time: 2015-04-18_01:51:17
Locale: fi_FI
Comment 5 QA Administrators 2016-09-20 09:33:11 UTC Comment hidden (obsolete)
Comment 6 Buovjaga 2019-08-11 10:28:14 UTC
Still repro.

Arch Linux 64-bit
Build ID: 37fc9f51a8de11d40632e8cda17ccf1fa4b1f503
CPU threads: 8; OS: Linux 5.2; UI render: default; VCL: gtk3; 
Locale: fi-FI (fi_FI.UTF-8); UI-Language: en-US
Calc: threaded
Built on 6 August 2019
Comment 7 Desiree Hill 2019-09-16 11:14:42 UTC Comment hidden (spam)
Comment 8 Commit Notification 2019-09-27 18:27:32 UTC
Andreas Heinisch committed a patch related to this issue.
It has been pushed to "master":


tdf#50846 - Wrong type of function GetLastUsedRow

It will be available in 6.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:

Affected users are encouraged to test the fix and report feedback.