Re: Makro um Namen zu platzieren nach Reihenfolge
Verfasst: Di, 17.01.2023 20:57
...stimmt, durch eigene Bilder war die Datei zu groß. Habe die Bilder mal rausgenommen
deutsches Forum rund um Apache OpenOffice und LibreOffice
https://de.openoffice.info/
Code: Alles auswählen
osf1.SortAscending = false
Code: Alles auswählen
osf1.SortAscending = true
Code: Alles auswählen
sub Sort_by_descriptor(oSheet)
dim nColumn as integer
dim osfs(0) as object
DIM osf1 as new com.sun.star.util.SortField
oSortRange = oSheet.getcellrangebyName("C2:D5")
for j = 0 to 3
oNameCell = oSortRange.getcellbyposition(0,j)
if oNameCell.String = "" then
bfound = true
exit for
endif
next j
if bfound = true then
oSortRange = oSortRange.GetCellrangebyPosition(0,0,1,j-1)
endif
nColumn = 1 '<<<--------------------------------------libreoffice geht auch mit :3
osf1.field = nColumn
osf1.SortAscending = false
osfs(0) = osf1
oSortDescriptor = oSortRange.createSortDescriptor
for i = 0 to uBound(oSortDescriptor)
oProp = oSortDescriptor(i)
with oProp
if .Name = "ContainsHeader" then
.Value = false
oSortDescriptor(i) = oProp
endif
if .Name = "SortFields" Then
.Value = osfs
oSortDescriptor(i) = oProp
endif
end with
next i
oSortRange.sort(oSortDescriptor)
end sub