Sub TabellenSorterenNumeriek()
Application.ScreenUpdating = False
Dim i As Long, j As Long, k As Long
Dim strVal As String, StrTbls As String
Dim RngOld As Range, RngNew As Range, bClr As Boolean
Dim tmpArr As Variant
bClr = False
With ActiveDocument
If .Tables.Count < 2 Then GoTo CleanUp
If .Paragraphs.First.Range.Information(wdWithInTable) = True Then
.Tables(1).Range.Cut
.Paragraphs.First.Range.InsertBefore vbCr & vbCr
.Range.Paragraphs.First.Range.Characters.Last.Next.Paste
bClr = True
End If
Restart:
StrTbls = ""
For i = 1 To .Tables.Count
strVal = Left(.Tables(i).Cell(1, 1).Range.Text, Len(.Tables(i).Cell(1, 1).Range.Text) - 2)
If Not StrTbls & "" = "" Then StrTbls = StrTbls & "," & strVal Else: StrTbls = strVal
Next
tmpArr = Split(StrTbls, ",")
For i = LBound(tmpArr) To UBound(tmpArr) - 1
For j = i + 1 To UBound(tmpArr)
If CInt(tmpArr(j)) < CInt(tmpArr(i)) Then
Set RngOld = .Tables(j + 1).Range
With RngOld
If .Paragraphs.Last.Next.Range.Text = vbCr Then .Paragraphs.Last.Next.Range.Delete
.Cut
End With
Set RngNew = .Tables(i + 1).Range.Paragraphs.First.Previous.Range.Characters.Last
With RngNew
.Collapse wdCollapseStart
.InsertAfter vbCr
.Collapse wdCollapseEnd
.Paste
End With
GoTo Restart
End If
Next
Next
CleanUp:
If bClr = True Then .Paragraphs.First.Range.Delete
End With
Set RngOld = Nothing
Set RngNew = Nothing
Application.ScreenUpdating = True
End Sub