Warum habe ich hier einen Laufzeitfehler? Wo -> FEHLER steht? Unten!
Sub Draw2
dim aGames (2) as Integer
dim finalSet as String
dim sheet as Object
dim cell as Object
dim aSets (5) as String 'Feld von Strings
dim pos1 as Integer, pos2 as Integer
dim cell1 as String
dim cell2 as String
pos1 = 1
pos2 = 1
for i = 1 to 5
sheet = thisComponent.Sheets(2) 'Tabellenblatt via Index = Auslosung
cell = sheet.getCellByPosition (0,2) '1. Ergebnis
aSets = split (cell.String, " ")
finalSet = aSets (ubound(aSets))
msgbox "letzter Satz" & finalSet
aGames = split (finalSet, ":")
cell = sheet.getCellByPosition (3,pos1)
cell1 = cell.String
if (aGames(0) > aGames(1)) then 'erster Spieler ist der Sieger
cell = sheet.getCellByPosition(0,pos2) 'Spalte , Zeile
cell2 = cell.String
cell = sheet.getCellByPosition(3,pos1) 'Spalte , Zeile
cell.String = cell2
elseif (aGames(0) !!!FEHLER!!! cell = sheet.getCellByPosition(4,pos1)
if(cell.String <> "") then
pos1=pos1+2
end if
cell = sheet.getCellByPosition(4,pos1)
cell.String = cell2
end if
pos1=pos1+2
pos2=pos2+2
next i
End Sub |