je voudrais additionner les cellules d'une colonne dont le début est K10 et la fin est aléatoire.
j'ai testé ceci mais il me retourne une erreur.
Code : Tout sélectionner
Sub TotalAirCare()
Dim oFeuille As Object
Dim oCell As Object
Dim oPlageTotalAirCare As Object
Dim j As integer
Dim fonc As Integer
Dim resultat As Double
oFeuille = ThisComponent.Sheets.getByIndex(0)
J =10
oCell = oFeuille.getCellByPosition(10,j)
while oCell.string <> "" and j < 30
j = j + 1
oCell = oFeuille.getCellByPosition(10,j)
wend
'MsgBox j
oPlageTotalAirCare = oFeuille.getCellRangeByPosition(10,10,10,j)
fonc = com.sun.star.sheet.GeneralFunction.SUM
resultat = oPlageTotalAirCare.computeFunction(fonc)
oCell.getCellByPosition(10,j).Value = resultat
End Sub
Code : Tout sélectionner
oCell.getCellByPosition(10,j).Value = resultat
erreur : une exception s'est produite:
Type: com.sun.star.lang.IndexOutOfBoundsException
une idée merci



