Get/Set value from/to Cell in LibreOffice BASIC

I have the following code in Microsoft Office Excel, in a .xlsm file, that’s part of a VBA Sub.

'Read a value in a Cell that is named cellName
'and stores in a variable named aVariable

aVariable = Range("cellName").Value


'Read the value from a variable named aVariable
'and stores in a Cell that is named cellName

Range("cellName").Value = aVariable

How do I rewrite this so it’s compatible to Libre Office Calc Basic (.ods, using LibreOfficeCalc)? Is there a way to do this that is both compatible with the Microsoft Office and Libre Office?

A spreadsheet is created using MS Excel which contains VBA code. If this .xlsm file is opened in LO in most cases the VBA code will run. When the file is open in LO look at the macros contained in the file. You will find VBAProject > Modules > Module1 contains the VBA code. The code will be preceded with

Rem Attribute VBA_ModuleType=VBAModule
Option VBASupport 1

The VBAModule attempts to run the VBA code without converting to LO Basic.

If you write code in LO Basic then it will not run if you open the file with MS Excel.

So if you want to be able to open the file and run macros in both MS Excel and LO then use VBA code with the VBASupport set for compatibility…

Could you just add the libreoffice equivalent code?