I always deprecate incomplete IF()
expressions, but basically the HYPERLINK()
function as applied in cells E4
and E2
respectively of the demonstrating sheets in my example can exactly do this. However, it doesn’t “insert the macro” but creates a link (hyperlink as the name says) in URI
-fashion by which you can call the macro.
The relevant difference as compared to referencing resources of the internet is the so-callled scheme
, the part before the colon. Intending to call a macro from inside a LibreOffice application this must be vnd.sun.star.script
. Behind the colon must follow point-separated the (case regarding) names of the Library, the Module, and the Routine, in your case Standard.Module1.Main
(where the automatic names are not recommendable). Since libraries can be created for different scriptring languages, and can be provided either via the user profile (here addressed as “application”) or by the current component (“document”), the URI has in addition a Query Part
separated as a whole by the question mark and internally by the ampersand into “equations” describing the needed information.
===Edit===
Having defined a few new named ranges, I recorded a slightly shortened macro and linked it into the next sheet as described above. See new attachment:
MacroTestTodayOrYesterdayQuestionmark.ods (24.5 KB)
===/Edit===