Hello,
though I fully support @SM_Riga’s solution, here’s a code snippet (no error handling, no cell reference as parameter, just the idea how it could be done) which does what you want:
Sub CellValueIncrement()
Dim oSheet As Object
Dim oRange As Object
Dim oCell As Object
Dim iCurVal As Integer
Dim iNewVal As Integer
oSheet = ThisComponent.CurrentController.ActiveSheet
oRange = oSheet.getCellRangebyName( "B2" )
oCell = oRange.getCellByPosition(0,0)
iCurVal = oCell.value
iNewVal = iCurVal + 1
oCell.Value = iNewVal
End Sub
Tested using LibreOffice:
Version: 6.4.4.2, Build ID: 3d775be2011f3886db32dfd395a6a6d1ca2630ff
CPU threads: 8; OS: Linux 4.12; UI render: default; VCL: kf5;
Locale: en-US (en_US.UTF-8); UI-Language: en-US, Calc: threaded