Libre:office 25.2.3.2 Spreadsheet
MacOS: 15.5
BASIC runtime error. Property or method not found:
I’m getting the above error. It prevents me from accessing the file to fix it.
How do I get past the error so I can fix the file?
Libre:office 25.2.3.2 Spreadsheet
MacOS: 15.5
BASIC runtime error. Property or method not found:
I’m getting the above error. It prevents me from accessing the file to fix it.
How do I get past the error so I can fix the file?
This happens in the Macro editor.
If you can upload the file, we will fix this file.
Press Esc and hold until all the cells using some problematic macro had been skipped.
Function IRSSINGLE(agi)
Dim doc As Object
Dim sheet As Object
doc = ThisComponent
sheet = doc.Sheets.getByName("Sheet2")
sheet.getCellRangeByName("D1").Value = agi
IRSSINGLE = sheet.getCellRangeByName("E9").Value
End Function
This calls a function, then returns with a value. It is used numerous times in the spreadsheet so I made it into a function. The function itself works. The problem I’m having is getting the macro to work.
So you created a user-defined spreadsheet function, that in order to calculate its value, must change some cell in the spreadsheet, get another dependent cell calculated, and get its value?
You are definitely doing it wrong. In user-defined spreadsheet functions (UDFs), you must not change anything in the spreadsheet - the function must only calculate something itself.
And as @sokol92 mentioned, the spreadsheet is needed.
It doesnt matter if it should used as UDF or not, but you can NOT run a function with an argument in its signature directly inside the Basic-IDE
Roth Conversion.ods (29.2 KB)
“… you can NOT run a function with an argument in its signature directly inside the Basic-IDE”
It worked in IRSSINGLE (sheet1:B11). Virtually the same thing at WIDORSINGLE (sheet1:B12) does not.
Your function:
Function WIDORSINGLE(agi)
Dim doc As Object
Dim sheet As Object
doc = ThisComponent
sheet = doc.Sheets.getByName("Sheet2")
sheet.getCellRangeByName("D13").Value = agi
WIDORSINGLE = sheet.getCellRangeByName("E18").Value
End Function
is complete nonsense, because you can use it exactly once, and in conclusion instead the UDF:
# ⇒ Sheet2.D13:
=Sheet1.B10
# ⇒ Sheet1.B12:
=Sheet2.E18