mijn ListObject(2) begint nu vast op rij 30.
Hoe kan ik dit variabel maken ?
deze zou moeten starten 2 rijen lager dan waar ListObject(1) eindigt.
Hoe kan ik dit variabel maken ?
deze zou moeten starten 2 rijen lager dan waar ListObject(1) eindigt.
Code:
Sub registratie()
Dim j As Long, t As Long, ar
ar = Sheets("data").ListObjects(1).DataBodyRange
With Sheets("controle")
For j = 1 To UBound(ar)
If ar(j, 1) = .Range("B1").Value And CStr(ar(j, 5)) = CStr(.Range("B2").Value) Then
c00 = c00 & j & "|"
t = t + 1
End If
Next j
With .ListObjects(1)
If .ListRows.Count Then .DataBodyRange.Delete
If t > 0 Then
.ListRows.Add.Range.Resize(t, 15) = Application.Transpose(Application.Index(ar, Split(c00, "|"), Application.Transpose(Array(60, 3, 8, 11, 15, 18, 59, 55, 56, 21, 32, 33, 31, 42, 43))))
.Range.Sort .Range.Cells(1, 2), , .Range.Cells(1, 3), , , , , x1Yes
End If
End With
.ListObjects(2).Range.Cut .Cells(30, 1)
End With
End Sub
Sub boordcomputer()
Set hoofding = Range(Cells(3, 1), Cells(3, 10))
hoofding.Copy
Range(Cells(30, 1), Cells(30, 10)).PasteSpecial xlPasteValues
Dim j As Long, t As Long, ar
ar = Sheets("boordcomputer").ListObjects(1).DataBodyRange
With Sheets("controle")
For j = 1 To UBound(ar)
If ar(j, 1) = .Range("B1").Value And CStr(ar(j, 5)) = CStr(.Range("B2").Value) Then
c00 = c00 & j & "|"
t = t + 1
End If
Next j
With .ListObjects(2)
If .ListRows.Count Then .DataBodyRange.Delete
If t > 0 Then
.ListRows.Add.Range.Resize(t, 9) = Application.Transpose(Application.Index(ar, Split(c00, "|"), Application.Transpose(Array(20, 3, 8, 10, 11, 14, 19, 17, 18))))
.Range.Sort .Range.Cells(1, 2), , .Range.Cells(1, 3), , , , , x1Yes
End If
End With
End With
End Sub