Hello,
one (!) solution:
Sub SetCellValue()
dim oDoc as object
dim oSheet as object
dim oCell as object
oDoc = ThisComponent.CurrentController
oSheet = oDoc.ActiveSheet
oCell = oSheet.getCellByPosition(0,0)
oCell.value = 1
End Sub
Note(s)
- indexing starts using
0
, hence A1
equals (0,0)
- If you want to read, use:
var = oCell.value
(numeric), var = oCell.string
(string), or var = oCell.formula
(formula) and oCell.Type
to get the content type.
You may want to use the BASIC Reference Cards
Macro tested using:
Version: 7.0.4.2, Build ID: dcf040e67528d9187c66b2379df5ea4407429775
CPU threads: 8; OS: Linux 5.3; UI render: GL; VCL: kf5
Locale: de-DE (de_DE.UTF-8); UI: de-DE, Calc: threaded
Hope that helps