Use a macro to access sheets. Text of macro follows. REM ***** BASIC ***** Sub Main End Sub Function ReturnSheetName(Optional nSheet) If IsMissing(nSheet) Then ReturnSheetName = ThisComponent.getCurrentController.getActiveSheet.getName() Else ReturnSheetName = ThisComponent.getSheets().getByIndex(nSheet-1).getName() EndIf End Function function number_of_sheets() number_of_sheets = ThisComponent.Sheets.Count end function When the spreadsheet is opened error messages are thrown: BASIC runtime error. An exception occurred Type: com.sun.star.lang.IndexOutOfBoundsException Message: . BASIC runtime error. Property or method not found: getSheets. By clicking on the "Ok" box of the error message window every time it appears, the spreadsheet will eventuall open. Then, CTRL+f9 in the cells showing error will fix everything and the desired result is achieved. If the macro eventually works, why the errors when the spreadsheet is opened? cell contents (of cell B10), call to getSheets: =RETURNSHEETNAME(ROW()-8) used for (contents of adjacent cell, C10): =INDIRECT("$'"&B10&"'"&".$E$4") The idea is to avoid having to type in the sheet names, and pull values from the desired sheet.
(In reply to Henry Hall from comment #0) >When the spreadsheet is opened error messages are thrown: This issue looks like a duplicate of: Bug 123005 - FILEOPEN: Error on creating getCurrentController().getActiveSheet() for basic script from location=document > The idea is to avoid having to type in the sheet names, and pull values from > the desired sheet. Maybe this could be a workaround: =MID(CELL("FILENAME");FIND("#$";CELL("FILENAME")&0*RAND())+2;256) Bug 121422 - The CELL function does not change the result after changing the name of the sheet.
Hello Henry, Does the suggestion made by Oliver work for you ?
Dear Henry Hall, This bug has been in NEEDINFO status with no change for at least 6 months. Please provide the requested information as soon as possible and mark the bug as UNCONFIRMED. Due to regular bug tracker maintenance, if the bug is still in NEEDINFO status with no change in 30 days the QA team will close the bug as INSUFFICIENTDATA due to lack of needed information. For more information about our NEEDINFO policy please read the wiki located here: https://wiki.documentfoundation.org/QA/Bugzilla/Fields/Status/NEEDINFO If you have already provided the requested information, please mark the bug as UNCONFIRMED so that the QA team knows that the bug is ready to be confirmed. Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-NeedInfo-Ping
Dear Henry Hall, Please read this message in its entirety before proceeding. Your bug report is being closed as INSUFFICIENTDATA due to inactivity and a lack of information which is needed in order to accurately reproduce and confirm the problem. We encourage you to retest your bug against the latest release. If the issue is still present in the latest stable release, we need the following information (please ignore any that you've already provided): a) Provide details of your system including your operating system and the latest version of LibreOffice that you have confirmed the bug to be present b) Provide easy to reproduce steps – the simpler the better c) Provide any test case(s) which will help us confirm the problem d) Provide screenshots of the problem if you think it might help e) Read all comments and provide any requested information Once all of this is done, please set the bug back to UNCONFIRMED and we will attempt to reproduce the issue. Please do not: a) respond via email b) update the version field in the bug or any of the other details on the top section of our bug tracker Warm Regards, QA Team MassPing-NeedInfo-FollowUp
*** This bug has been marked as a duplicate of bug 125042 ***