AW: Sortieren von Arbeitsblättern
14.09.2009 21:06:11
Arbeitsblättern
Hallo,
hier noch eine Version,
in der Zeile For i = 2 To .Sheets.Count kannst Du durch die 2 die erste Tabelle aus lassen.
Sub InsertValue(NewVal As String, ByRef sArray As Variant)
Dim i As Integer ' Zähler
Dim varRow
varRow = Application.Match(NewVal, sArray, 1)
If IsNumeric(varRow) Then
Redim Preserve sArray(Ubound(sArray) + 1)
For i = Ubound(sArray) To varRow Step -1
sArray(i) = sArray(i - 1)
Next i
sArray(varRow) = NewVal
End If
End Sub
Sub SortTabelle()
Dim meAr() As String, i As Integer
With ThisWorkbook
Redim Preserve meAr(0)
For i = 2 To .Sheets.Count 'ohne erste sonst 1
InsertValue .Sheets(i).Name, meAr
Next i
Application.ScreenUpdating = False
For i = Ubound(meAr) To Lbound(meAr) + 1 Step -1
.Sheets(meAr(i)).Move After:=.Sheets(i)
Next i
Application.ScreenUpdating = True
End With
End Sub
Gruß Tino