Code: Alles auswählen
=LASTUSED("EX")
Code: Alles auswählen
=LASTUSED(12)
Moderator: Moderatoren
Code: Alles auswählen
=LASTUSED("EX")
Code: Alles auswählen
=LASTUSED(12)
wenn möglich wie jede Funktion so flexible wie möglich also eben auch ziehen.balu hat geschrieben:Wo willst Du deine eigene Funktion =LUCI() einsetzen?
Code: Alles auswählen
Function LUCI(xCol)
iCol = xCol-1
oDoc = ThisComponent
oSheet = oDoc.Sheets(0)
iCol = xCol-1
' sTick = GetSystemTicks()
aFunc = GetProcessServiceManager().createInstance("com.sun.star.sheet.FunctionAccess")
Xs = 1048576 : do : Xe = Xs : Xs = Xe/2
NRange = oSheet.getCellRangeByPosition(iCol,Xs,iCol,Xe-1)
Test1 = aFunc.callFunction("COUNTA", Array(NRange))
if xs = 1 then Line = 1
if Test1 > 0 then : do
if Xe-Xs < 4 then
for i=Xe to Xs step -1
Result = oSheet.getCellByPosition(iCol,i-1)
if Result.Type <> 0 then Line = i : exit do
next : end if
Xa = Xs : Xb = Xe : Xs = Xs + (Xe-Xs)/2
NRange = oSheet.getCellRangeByPosition(iCol,Xs,iCol,Xe-1)
Test2 = aFunc.callFunction("COUNTA", Array(NRange))
if Test2 = 0 then Xb = Xs : Xs=xa : Xe=Xb : Test2 = 1
loop until Test2 = 0 : end if : loop while isEmpty(Line)
LUCI=Line
' eTick = GetSystemTicks()
' print line, "get in " & eTick-sTick
end Function
Code: Alles auswählen
Function LUCI(xCol)
iCol = xCol-1
oDoc = ThisComponent
oSheet = oDoc.Sheets(0)
iCol = xCol-1
' sTick = GetSystemTicks()
aFunc = GetProcessServiceManager().createInstance("com.sun.star.sheet.FunctionAccess")
Xs = 1048576
do
Xe = Xs
Xs = Xe/2
NRange = oSheet.getCellRangeByPosition(iCol,Xs,iCol,Xe-1)
Test1 = aFunc.callFunction("COUNTA", Array(NRange))
if xs = 1 then Line = 1
if Test1 > 0 then
do
if Xe-Xs < 4 then
for i=Xe to Xs step -1
Result = oSheet.getCellByPosition(iCol,i-1)
if Result.Type <> 0 then
Line = i
exit do
end if
next
end if
Xa = Xs
Xb = Xe
Xs = Xs + (Xe-Xs)/2
NRange = oSheet.getCellRangeByPosition(iCol,Xs,iCol,Xe-1)
Test2 = aFunc.callFunction("COUNTA", Array(NRange))
if Test2 = 0 then
Xb = Xs
Xs=xa
Xe=Xb
Test2 = 1
end if
loop until Test2 = 0
end if
loop while isEmpty(Line)
LUCI=Line
' eTick = GetSystemTicks()
' print line, "get in " & eTick-sTick
end Function
Code: Alles auswählen
Function LUCI(xCol)
oDoc = ThisComponent
oSheet = oDoc.Sheets(0)
ocol=osheet.columns(xCol-1)
oleer=ocol.queryemptycells
oleerletzte=oleer.getbyindex(oleer.getcount-1).getcellbyposition(0,0).celladdress.row
LUCI=oleerletzte
End Function