von LSH_Dackel » Do, 31.08.2006 18:22
Hi Leute
ihr hatted jetz zwar ma ne weile ruhe vor meiner fragerei aber alles hat ein mal ein Ende.
Ich habe folgendes problem:
Ich habe mein bubble-sort so um geschrieben das es auch text verwendet
nun wird aber der zu letzt eingelesene "Text" nicht in die tabelle übertragen wie bei der version die nur mit Zahlen arbeited.
Dies war die ursprüngliche Version:
Code: Alles auswählen
sub ranking22HJTemp2_BP
Dim Entry(1, 31)
Dim Count As Double
Dim Count2 As Double
Dim Temp As Double
oSheets = ThisComponent.Sheets
oSheet = oSheets.getByName("HJLübersicht")
Entry(0,1) = oSheet.getCellByposition(38,6).value
.
.
Entry(1,1) = oSheet.getCellByposition(37,6).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, 37 - oSheet.getCellByposition(49,36).value).value = (Entry (0,Count))
oSheet.getCellByposition(47, 36 - oSheet.getCellByposition(49,36).value).setformula(Entry (1,Count))
next
end sub
Und das ist die neue:
Code: Alles auswählen
sub ranking22HJTemp2_BP
Dim Entry(1, 31)
Dim Count As Double
Dim Count2 As Double
Dim Temp As Double
oSheets = ThisComponent.Sheets
oSheet = oSheets.getByName("HJLübersicht")
Entry(0,1) = oSheet.getCellByposition(38,6).string
.
.
Entry(1,1) = oSheet.getCellByposition(37,6).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, 37 - oSheet.getCellByposition(49,36).value).setformula(Entry (0,Count))
oSheet.getCellByposition(47, 36 - oSheet.getCellByposition(49,36).value).setformula(Entry (1,Count))
next count
end sub
oSheet.getCellByposition(49,36).value 'zählt leerzellen in der tabelle
Ich check einfach net warum dieser fehler auftrit da ich nix wesentliches verändert hab .
Bestimmt lach sich einer von euch wegen meinen n00b-fragen kaputt oder is scho genervt aber ihr checkts halt im gegensatz zu mir richtig aus
Also schon ma THX im vorraus
Hi Leute
ihr hatted jetz zwar ma ne weile ruhe vor meiner fragerei aber alles hat ein mal ein Ende. :oops:
Ich habe folgendes problem:
Ich habe mein bubble-sort so um geschrieben das es auch text verwendet
nun wird aber der zu letzt eingelesene "Text" nicht in die tabelle übertragen wie bei der version die nur mit Zahlen arbeited.
Dies war die ursprüngliche Version:
[code]sub ranking22HJTemp2_BP
Dim Entry(1, 31)
Dim Count As Double
Dim Count2 As Double
Dim Temp As Double
oSheets = ThisComponent.Sheets
oSheet = oSheets.getByName("HJLübersicht")
Entry(0,1) = oSheet.getCellByposition(38,6).value
.
.
Entry(1,1) = oSheet.getCellByposition(37,6).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, 37 - oSheet.getCellByposition(49,36).value).value = (Entry (0,Count))
oSheet.getCellByposition(47, 36 - oSheet.getCellByposition(49,36).value).setformula(Entry (1,Count))
next
end sub
[/code]
Und das ist die neue:
[code]sub ranking22HJTemp2_BP
Dim Entry(1, 31)
Dim Count As Double
Dim Count2 As Double
Dim Temp As Double
oSheets = ThisComponent.Sheets
oSheet = oSheets.getByName("HJLübersicht")
Entry(0,1) = oSheet.getCellByposition(38,6).string
.
.
Entry(1,1) = oSheet.getCellByposition(37,6).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, 37 - oSheet.getCellByposition(49,36).value).setformula(Entry (0,Count))
oSheet.getCellByposition(47, 36 - oSheet.getCellByposition(49,36).value).setformula(Entry (1,Count))
next count
end sub[/code]
oSheet.getCellByposition(49,36).value 'zählt leerzellen in der tabelle
Ich check einfach net warum dieser fehler auftrit da ich nix wesentliches verändert hab .
Bestimmt lach sich einer von euch wegen meinen n00b-fragen kaputt oder is scho genervt aber ihr checkts halt im gegensatz zu mir richtig aus 8)
Also schon ma THX im vorraus