OOo Calc の A1:D4 をインクリメントする OOo Basic コード

Sub Main
rem ----------------------------------------------------------------------
rem define variables
   Dim oCell As Object, oSheet As Object
rem ----------------------------------------------------------------------
rem get access to the document
   oSheet = ThisComponent.Sheets(0)
   
   rem 主処理をここに書く
   nCols = 3
   nRows = 3
   
   For i = 0 To nRows Step 1
      For j = 0 To nCols Step 1
         oCell = oSheet.getCellByPosition(j,i)
         oCell.Value = oCell.Value + 1
      Next
   Next

End Sub