Did you ever write a bit of code in one of the common (imperative) programming languages? In BASIC?
Did you ever access/handle an object like a cell of a spreadsheet?
The complete alternative in BASIC, e.g, is
IF condition Then
thenStatementBlock
Else
elseStatementBlock
End If
A blank cell is characterised by oCell.Type=3
Driver’s license first. Then drive.
-1- Study the BASIC guide.
-2- Study the API of LibreOffice.
-3- Try first examples.
-4- Do not start with “recorded macros”.
Sub Test
REM Get Cell C12 of the fisrt sheet (leftmost tab).
oCell = ThisComponent.Sheets(0).GetCellByPosition(2, 11)
IF oCell.Type=0 Then
oCell.ClearContents(com.sun.star.sheet.CellFlags.HARDATTR)
End If
REM "Incomplete alternative" or "conditional staement" here.
REM See https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1sheet_1_1CellFlags.html
End Sub
(Edited regarding the comment by @DesertMan1 (OQ) below.)
If you want to call a routine working on any Cell / CellRange / CellRanges as objects you need to pass parameters identifying the object and making it accessible for the code.
In your case a call to the respective function, intending to apply the ‘Ctrl+M’ action to the one cell the formula resides in, might read:
=IF(A1="";CLEAR_FORMATTING_1CELL(SHEET(A1); ROW(A1); COLUMN(A1));A1+1)
Based on this call user code can assign the respective cell object like this:
myCell = ThisComponent.Sheets(param1-1).GetCellByPosition(param3-1, param2-1)
You surely understand that this code is just a rough sketch.
Anyway the intended action will not be performed if restrictions mentioned in my comment to the answer by @jimk apply.
To all: This is an international forum in English language. The only parameter delimiter supported locale-independent for Calc formulae is the semicolon (not the comma).
This is different, of course, in BASIC.