Ik heb inderdaad nog een aantal gegevens in kolom C staan, welk deel van de macro zou ik moeten aanpassen om die gegevens ook in de tabel te zetten?
Dan moet in het resultaat voor elke crediteur een kolom bijgemaakt worden.
Je kunt dan onderstaande macro gebruiken.
Sub macro3()
Dim hm As Integer, x As Integer, y As Integer
Sheets(2).Cells.ClearContents
With Application
.ScreenUpdating = False
On Error GoTo melding
hm = .InputBox("Aantal gegevens per persoon?")
If .IsNumber(hm) = False Then
melding:
MsgBox "Foutieve invoer!", vbCritical
GoTo einde
End If
End With
With Sheets(1)
.Range("a1:a" & hm).Copy Sheets(2).Range("a1")
x = 1: y = 0
Do Until x > .Cells(.Rows.Count, 1).End(xlUp).Row
y = y + 2
.Range(.Cells(x, 2), .Cells(x + hm - 1, 3)).Copy Sheets(2).Cells(1, y)
x = x + hm
Loop
End With
With Sheets(2).Cells
.HorizontalAlignment = xlLeft
.WrapText = False
.Borders.LineStyle = xlLineStyleNone
For x = 1 To y + 2 Step 2
.Range(.Cells(1, x), .Cells(hm, x)).Borders(xlEdgeRight).Weight = xlMedium
Next x
End With
Application.ScreenUpdating = True
einde:
End Sub