von Stephan » So, 10.09.2006 20:37
Ich habe es auch schon mit der verbesserten version probier aber da die auch zum absturz geführt hat habe ich das dokument verworfen.
und nun?
Also eigentlich solltest Du jetzt das Makro debuggen, was angesichst der Tatsache das OOo abstürzt dadurch möglich wäre das Du an günstigen Stellen des Makros Message-Boxen plazierst und beobachtest welche diese Messageboxen als letzte angezeigt wird bevor OOo abstürtzt. So hätten wir zumindest einen Hinweis wo wir den Fehler suchen müßten, obwohl ich bezüglich des Absturzes nicht mal eine Vermutung hätte wenn wir wüßten wo etwas fehlerhaft ist, was dann fehlerhaft ist, denn der Code ist gut zu überblicken.
Da wir nun zunächst garnicht wissen wie der Absturz zustande kommt wäre es wohl am Einfachsten einen Code zu verwenden der gegenüber dem von Dir als funktionierend benannten Ausgangscode möglichst wenig verändert ist. Deshalb probiere mal ob ein einfaches Umsortieren der schon fertig eingetragenen Werte keinen Absturz erzeugt:
Code: Alles auswählen
sub ranking22HJTemp2_BP
Dim Entry(1, 31)
Dim Count As Double
Dim Count2 As Double
oSheets = ThisComponent.Sheets
oSheet = oSheets.getByName("HJLübersicht")
Entry(0,1) = oSheet.getCellByposition(38,6).formula
Entry(0,2) = oSheet.getCellByposition(38,7).formula
Entry(0,3) = oSheet.getCellByposition(38,8).formula
Entry(0,4) = oSheet.getCellByposition(38,9).formula
Entry(0,5) = oSheet.getCellByposition(38,10).formula
Entry(0,6) = oSheet.getCellByposition(38,11).formula
Entry(0,7) = oSheet.getCellByposition(38,12).formula
Entry(0,8) = oSheet.getCellByposition(38,13).formula
Entry(0,9) = oSheet.getCellByposition(38,14).formula
Entry(0,10) = oSheet.getCellByposition(38,15).formula
Entry(0,11) = oSheet.getCellByposition(38,16).formula
Entry(0,12) = oSheet.getCellByposition(38,17).formula
Entry(0,13) = oSheet.getCellByposition(38,18).formula
Entry(0,14) = oSheet.getCellByposition(38,19).formula
Entry(0,15) = oSheet.getCellByposition(38,20).formula
Entry(0,16) = oSheet.getCellByposition(38,21).formula
Entry(0,17) = oSheet.getCellByposition(38,22).formula
Entry(0,18) = oSheet.getCellByposition(38,23).formula
Entry(0,19) = oSheet.getCellByposition(38,24).formula
Entry(0,20) = oSheet.getCellByposition(38,25).formula
Entry(0,21) = oSheet.getCellByposition(38,26).formula
Entry(0,22) = oSheet.getCellByposition(38,27).formula
Entry(0,23) = oSheet.getCellByposition(38,28).formula
Entry(0,24) = oSheet.getCellByposition(38,29).formula
Entry(0,25) = oSheet.getCellByposition(38,30).formula
Entry(0,26) = oSheet.getCellByposition(38,31).formula
Entry(0,27) = oSheet.getCellByposition(38,32).formula
Entry(0,28) = oSheet.getCellByposition(38,33).formula
Entry(0,29) = oSheet.getCellByposition(38,34).formula
Entry(0,30) = oSheet.getCellByposition(38,35).formula
Entry(0,31) = oSheet.getCellByposition(38,36).formula
Entry(1,1) = oSheet.getCellByposition(37,6).formula
Entry(1,2) = oSheet.getCellByposition(37,7).formula
Entry(1,3) = oSheet.getCellByposition(37,8).formula
Entry(1,4) = oSheet.getCellByposition(37,9).formula
Entry(1,5) = oSheet.getCellByposition(37,10).formula
Entry(1,6) = oSheet.getCellByposition(37,11).formula
Entry(1,7) = oSheet.getCellByposition(37,12).formula
Entry(1,8) = oSheet.getCellByposition(37,13).formula
Entry(1,9) = oSheet.getCellByposition(37,14).formula
Entry(1,10) = oSheet.getCellByposition(37,15).formula
Entry(1,11) = oSheet.getCellByposition(37,16).formula
Entry(1,12) = oSheet.getCellByposition(37,17).formula
Entry(1,13) = oSheet.getCellByposition(37,18).formula
Entry(1,14) = oSheet.getCellByposition(37,19).formula
Entry(1,15) = oSheet.getCellByposition(37,20).formula
Entry(1,16) = oSheet.getCellByposition(37,21).formula
Entry(1,17) = oSheet.getCellByposition(37,22).formula
Entry(1,18) = oSheet.getCellByposition(37,23).formula
Entry(1,19) = oSheet.getCellByposition(37,24).formula
Entry(1,20) = oSheet.getCellByposition(37,25).formula
Entry(1,21) = oSheet.getCellByposition(37,26).formula
Entry(1,22) = oSheet.getCellByposition(37,27).formula
Entry(1,23) = oSheet.getCellByposition(37,28).formula
Entry(1,24) = oSheet.getCellByposition(37,29).formula
Entry(1,25) = oSheet.getCellByposition(37,30).formula
Entry(1,26) = oSheet.getCellByposition(37,31).formula
Entry(1,27) = oSheet.getCellByposition(37,32).formula
Entry(1,28) = oSheet.getCellByposition(37,33).formula
Entry(1,29) = oSheet.getCellByposition(37,34).formula
Entry(1,30) = oSheet.getCellByposition(37,35).formula
Entry(1,31) = oSheet.getCellByposition(37,36).formula
For Count = 1 To 31
For Count2 = Count + 1 To 31
If Entry(0,Count) < Entry(0,Count2) Then
Temp = Entry(0,Count)
Temp2 = Entry(1,Count)
Entry(0,Count) = Entry(0,Count2)
Entry(1,Count) = Entry(1,Count2)
Entry(0,Count2) = Temp
Entry(1,Count2) = Temp2
End If
Next Count2
Next Count
For Count = 1 To 31
oSheet.getCellByposition(48, 5 + Count).setformula(Entry (0,Count))
oSheet.getCellByposition(47, 5 + Count).setformula(Entry (1,Count))
next count
'Ergänzung
For i = 6 To 36
akt = oSheet.getCellByposition(48, i)
if akt.type = com.sun.star.table.CellContentType.VALUE Then
start = i
exit For
End if
Next i
Dim a(1, 30)
j = 0
For i = start to 36
if oSheet.getCellByposition(47, i).formula = "" Then
exit for
end if
a(0, j) = oSheet.getCellByposition(47, i).formula
a(1, j) = oSheet.getCellByposition(48, i).formula
j = j + 1
Next i
for i = 6 To start - 1
a(0, j) = oSheet.getCellByposition(47, i).formula
a(1, j) = oSheet.getCellByposition(48, i).formula
j = j +1
Next
For i = 0 To UBOUND(a(),2)
oSheet.getCellByposition(47, i+6).formula = a(0,i)
oSheet.getCellByposition(48, i+6).formula = a(1,i)
Next i
end sub
Falls das bei Dir wieder zu einem Absturz führt (bei mir läuft es) müssen wir dann als Nächstes wirklich den, den Code debuggen indem wir zunächst die Fehlerstelle lokalisieren.
Gruß
Stephan
[quote]Ich habe es auch schon mit der verbesserten version probier aber da die auch zum absturz geführt hat habe ich das dokument verworfen.[/quote]
und nun?
Also eigentlich solltest Du jetzt das Makro debuggen, was angesichst der Tatsache das OOo abstürzt dadurch möglich wäre das Du an günstigen Stellen des Makros Message-Boxen plazierst und beobachtest welche diese Messageboxen als letzte angezeigt wird bevor OOo abstürtzt. So hätten wir zumindest einen Hinweis wo wir den Fehler suchen müßten, obwohl ich bezüglich des Absturzes nicht mal eine Vermutung hätte wenn wir wüßten wo etwas fehlerhaft ist, was dann fehlerhaft ist, denn der Code ist gut zu überblicken.
Da wir nun zunächst garnicht wissen wie der Absturz zustande kommt wäre es wohl am Einfachsten einen Code zu verwenden der gegenüber dem von Dir als funktionierend benannten Ausgangscode möglichst wenig verändert ist. Deshalb probiere mal ob ein einfaches Umsortieren der schon fertig eingetragenen Werte keinen Absturz erzeugt:
[code]sub ranking22HJTemp2_BP
Dim Entry(1, 31)
Dim Count As Double
Dim Count2 As Double
oSheets = ThisComponent.Sheets
oSheet = oSheets.getByName("HJLübersicht")
Entry(0,1) = oSheet.getCellByposition(38,6).formula
Entry(0,2) = oSheet.getCellByposition(38,7).formula
Entry(0,3) = oSheet.getCellByposition(38,8).formula
Entry(0,4) = oSheet.getCellByposition(38,9).formula
Entry(0,5) = oSheet.getCellByposition(38,10).formula
Entry(0,6) = oSheet.getCellByposition(38,11).formula
Entry(0,7) = oSheet.getCellByposition(38,12).formula
Entry(0,8) = oSheet.getCellByposition(38,13).formula
Entry(0,9) = oSheet.getCellByposition(38,14).formula
Entry(0,10) = oSheet.getCellByposition(38,15).formula
Entry(0,11) = oSheet.getCellByposition(38,16).formula
Entry(0,12) = oSheet.getCellByposition(38,17).formula
Entry(0,13) = oSheet.getCellByposition(38,18).formula
Entry(0,14) = oSheet.getCellByposition(38,19).formula
Entry(0,15) = oSheet.getCellByposition(38,20).formula
Entry(0,16) = oSheet.getCellByposition(38,21).formula
Entry(0,17) = oSheet.getCellByposition(38,22).formula
Entry(0,18) = oSheet.getCellByposition(38,23).formula
Entry(0,19) = oSheet.getCellByposition(38,24).formula
Entry(0,20) = oSheet.getCellByposition(38,25).formula
Entry(0,21) = oSheet.getCellByposition(38,26).formula
Entry(0,22) = oSheet.getCellByposition(38,27).formula
Entry(0,23) = oSheet.getCellByposition(38,28).formula
Entry(0,24) = oSheet.getCellByposition(38,29).formula
Entry(0,25) = oSheet.getCellByposition(38,30).formula
Entry(0,26) = oSheet.getCellByposition(38,31).formula
Entry(0,27) = oSheet.getCellByposition(38,32).formula
Entry(0,28) = oSheet.getCellByposition(38,33).formula
Entry(0,29) = oSheet.getCellByposition(38,34).formula
Entry(0,30) = oSheet.getCellByposition(38,35).formula
Entry(0,31) = oSheet.getCellByposition(38,36).formula
Entry(1,1) = oSheet.getCellByposition(37,6).formula
Entry(1,2) = oSheet.getCellByposition(37,7).formula
Entry(1,3) = oSheet.getCellByposition(37,8).formula
Entry(1,4) = oSheet.getCellByposition(37,9).formula
Entry(1,5) = oSheet.getCellByposition(37,10).formula
Entry(1,6) = oSheet.getCellByposition(37,11).formula
Entry(1,7) = oSheet.getCellByposition(37,12).formula
Entry(1,8) = oSheet.getCellByposition(37,13).formula
Entry(1,9) = oSheet.getCellByposition(37,14).formula
Entry(1,10) = oSheet.getCellByposition(37,15).formula
Entry(1,11) = oSheet.getCellByposition(37,16).formula
Entry(1,12) = oSheet.getCellByposition(37,17).formula
Entry(1,13) = oSheet.getCellByposition(37,18).formula
Entry(1,14) = oSheet.getCellByposition(37,19).formula
Entry(1,15) = oSheet.getCellByposition(37,20).formula
Entry(1,16) = oSheet.getCellByposition(37,21).formula
Entry(1,17) = oSheet.getCellByposition(37,22).formula
Entry(1,18) = oSheet.getCellByposition(37,23).formula
Entry(1,19) = oSheet.getCellByposition(37,24).formula
Entry(1,20) = oSheet.getCellByposition(37,25).formula
Entry(1,21) = oSheet.getCellByposition(37,26).formula
Entry(1,22) = oSheet.getCellByposition(37,27).formula
Entry(1,23) = oSheet.getCellByposition(37,28).formula
Entry(1,24) = oSheet.getCellByposition(37,29).formula
Entry(1,25) = oSheet.getCellByposition(37,30).formula
Entry(1,26) = oSheet.getCellByposition(37,31).formula
Entry(1,27) = oSheet.getCellByposition(37,32).formula
Entry(1,28) = oSheet.getCellByposition(37,33).formula
Entry(1,29) = oSheet.getCellByposition(37,34).formula
Entry(1,30) = oSheet.getCellByposition(37,35).formula
Entry(1,31) = oSheet.getCellByposition(37,36).formula
For Count = 1 To 31
For Count2 = Count + 1 To 31
If Entry(0,Count) < Entry(0,Count2) Then
Temp = Entry(0,Count)
Temp2 = Entry(1,Count)
Entry(0,Count) = Entry(0,Count2)
Entry(1,Count) = Entry(1,Count2)
Entry(0,Count2) = Temp
Entry(1,Count2) = Temp2
End If
Next Count2
Next Count
For Count = 1 To 31
oSheet.getCellByposition(48, 5 + Count).setformula(Entry (0,Count))
oSheet.getCellByposition(47, 5 + Count).setformula(Entry (1,Count))
next count
'Ergänzung
For i = 6 To 36
akt = oSheet.getCellByposition(48, i)
if akt.type = com.sun.star.table.CellContentType.VALUE Then
start = i
exit For
End if
Next i
Dim a(1, 30)
j = 0
For i = start to 36
if oSheet.getCellByposition(47, i).formula = "" Then
exit for
end if
a(0, j) = oSheet.getCellByposition(47, i).formula
a(1, j) = oSheet.getCellByposition(48, i).formula
j = j + 1
Next i
for i = 6 To start - 1
a(0, j) = oSheet.getCellByposition(47, i).formula
a(1, j) = oSheet.getCellByposition(48, i).formula
j = j +1
Next
For i = 0 To UBOUND(a(),2)
oSheet.getCellByposition(47, i+6).formula = a(0,i)
oSheet.getCellByposition(48, i+6).formula = a(1,i)
Next i
end sub[/code]
Falls das bei Dir wieder zu einem Absturz führt (bei mir läuft es) müssen wir dann als Nächstes wirklich den, den Code debuggen indem wir zunächst die Fehlerstelle lokalisieren.
Gruß
Stephan