Dear Stackoverflow community
I am Cedric and I am extremely new to VBA programming and I have to tell you, that I am really stuck here. I hope someone can help me out. The attached Word document contains Tables (this is just a demo, in reality there will be an undefined amount of tables with undefinded amounts of rows).
I want to consolidate all of them to a single Table at the end of the document. Furthermore the heading row should only appear once, not every time.
Now it looks like the first image
enter image description here
Should look in the end like the second image
enter image description here
Many thanks in advance for your help.
Sub waldenwald()
Sub walde()
Dim t As Table, r As Row
Dim i As Integer
For Each t In ActiveDocument.Tables
For Each r In t.Rows
If r.Index > 1 Then
For i = 1 To 5
ActiveDocument.Tables(i).Range.Copy
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd
range2.Paste
Next i
End If
Next r
Next t
End Sub
Sub kopierensuperlean()
Dim i As Integer
For i = 1 To 5
ActiveDocument.Tables(i).Range.Copy
Set range2 = ActiveDocument.Content
range2.Collapse direction:=wdCollapseEnd
range2.Paste
Next i
End Sub
Cedric van Ravesteijn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.