Hallo Angelina,
habe wohl zuviel gelöscht :22:
habe wohl zuviel gelöscht :22:
Code:
Option Explicit
Option Base 1
Sub Zuordnen()
Dim wksGruppen As Worksheet
Dim rngSrc As Range, c As Range
Dim Grp As Integer, z As Integer
Dim aData(6)
On Error GoTo ErrorHandler
With Application
.ScreenUpdating = False
.Calculation = xlCalculationManual
End With
Set wksGruppen = Sheets("Forecast")
With wksGruppen
For Grp = 1 To 8
z = 0
Set rngSrc = .Range("Src_" & Format(Grp, "00"))
For Each c In rngSrc
If c.Value > "" Then
z = z + 1
aData(z) = c.Value
End If
Next c
QuickSort_Feld aData, 1, 6, False
.Cells(34 + Grp, 64).Resize(, 6) = aData
'------------------
Next Grp
End With
' wksGruppen.Activate
ErrorHandler:
With Application
.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub
Private Sub QuickSort_Feld(DasFeld, StartUnten, EndeOben, _
Absteigend As Boolean)
'QuickSort Standard
'von Peter Haserodt, online-excel.de
Dim iUnten As Long, iOben, iMitte, y
iUnten = StartUnten
iOben = EndeOben
iMitte = DasFeld((StartUnten + EndeOben) / 2)
While (iUnten <= iOben)
If Not Absteigend Then
While (DasFeld(iUnten) < iMitte And iUnten < EndeOben)
iUnten = iUnten + 1
Wend
While (iMitte < DasFeld(iOben) And iOben > StartUnten)
iOben = iOben - 1
Wend
Else
While (DasFeld(iUnten) > iMitte And iUnten < EndeOben)
iUnten = iUnten + 1
Wend
While (iMitte > DasFeld(iOben) And iOben > StartUnten)
iOben = iOben - 1
Wend
End If
If (iUnten <= iOben) Then
y = DasFeld(iUnten)
DasFeld(iUnten) = DasFeld(iOben)
DasFeld(iOben) = y
iUnten = iUnten + 1
iOben = iOben - 1
End If
Wend
If (StartUnten < iOben) Then Call _
QuickSort_Feld(DasFeld, StartUnten, iOben, Absteigend)
If (iUnten < EndeOben) Then Call _
QuickSort_Feld(DasFeld, iUnten, EndeOben, Absteigend)
End Sub
Gruß Stefan
Win 10 / Office 2016
Win 10 / Office 2016