How do I force cells with user functions to recalculate after I reopen a spreadsheet?

How do I force user functions to recalculate after I reopen a spreadsheet?
When I try this now, the formula results just show “#NAME?” after I reopen the file.
Neither pressing F9 nor selecting recalc will recalculate the cells.

This is on:

  • Mint 19.2
  • LibreOffice 6.0.7.3

This does happen in all cells with any user functions, not just the first cell that uses them.

A simple function this happens on is:

Function indstep(time, move)
	Dim val as Double
	val = move
	If time < 0 Then val = 0
	indstep = val
End Function

[Edit - Opaque] Formatted code sequence using style preformatted text

Hello - do you face the #NAME? error only on first cell using the user function? Had that in the past, with one of my functions and the issue was gone some day after having upgraded. Thus my question: Which LibreOffice version are you using on which operating system?

Please do not use Add Answer but edit your original question to enhance the details of your question. Thanks in advance …

PS: On my system (openSUSE 15.1, LibreOffice 6.3.4.2) the code works.

The user formula code needs to be entered into a module that is inside the file’s standard library and not a module beside the file’s standard library.

A module can be added to the standard library via the Tools menu → Organize Macros → LibreOffice Basic, then selecting the Calc file’s filename and pressing the New button.

The formulas that would not recalculate when the file was reopened were added to a module outside the file’s standard library. This library was added via: Tools → Organize Macros → LibreOffice Basic, then clicking on the Organizer button, selecting the Libraries tab, selecting the Calc file’s filename from the Location drop down list, selecting new and finally adding the code to the new Library.