
Bei meinem makro sollen werden werte nach größe sortiert werden.
das funzt auch wenn die werte zahlen sind , aber wenn es sich um Text handelt
wird dieser immer höher sortiert als die zahlen.
http://lshdackel.ls.funpic.de/Demo/Problem.jpg
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
end sub
THX im vorraus
MFG LSH_Dackel