Mvg
Piet
Wilma schreef:
Option Base 1
Option Explicit
Sub sorteerTabbladen()
Dim n, i, j As Integer
Dim Sorteerblad As String
Dim Namenlijst()
n = Sheets.Count
ReDim Namenlijst(n)
For i = 1 To n
Namenlijst(i) = Sheets(i).Name
Next i
SelectionSort Namenlijst
For i = 1 To UBound(Namenlijst)
Sheets(Namenlijst(i)).Move after:=Sheets(n)
Next i
End Sub
Function SelectionSort(TempArray As Variant)
Dim MaxVal As Variant
Dim MaxIndex As Integer
Dim i, j As Integer
' Step through the elements in the array starting with the
' last element in the array.
For i = UBound(TempArray) To 1 Step -1
' Set MaxVal to the element in the array and save the
' index of this element as MaxIndex.
MaxVal = TempArray(i)
MaxIndex = i
' Loop through the remaining elements to see if any is
' larger than MaxVal. If it is then set this element
' to be the new MaxVal.
For j = 1 To i
If TempArray(j) > MaxVal Then
MaxVal = TempArray(j)
MaxIndex = j
End If
Next j
' If the index of the largest element is not i, then
' exchange this element with element i.
If MaxIndex < i Then
TempArray(MaxIndex) = TempArray(i)
TempArray(i) = MaxVal
End If
Next i
End Function
Groeten,
Peter
"Wilma" <Wi...@discussions.microsoft.com> wrote in message
news:95AEDE6D-0BD7-4E4F...@microsoft.com...
"Peter Sellmeijer" <peter.se...@home.nl> schreef in bericht
news:3F54B607-226D-47A7...@microsoft.com...