Tango_Bravo
New Member
- Joined
- Jun 14, 2017
- Messages
- 33
<tbody>
</tbody>
here is a sample:
Orig doc | amendment | Date | Column4 | Column5 |
VAL00002540 | VAL00002540 | 7.11.2017 | ||
VAL00002540 | VAL00002541 | 7.11.2017 | ||
VAL00002564 | VAL00002564 | 27.11.2017 | | |
VAL00002564 | VAL00002696 | 27.3.2018 | | |
VAL00002564 | VAL00002697 | 27.3.2018 | | |
VAL00002566 | VAL00002566 | 30.11.2017 | ||
VAL00002566 | VAL00002593 | 21.12.2017 | ||
VAL00002566 | VAL00002594 | 21.12.2017 |
<tbody>
</tbody>
Col 1 represents indentification of the original document. Col 2 represents identification of the current document. Col. 3 represents date of the current document. Whenever vc(c, 1) = vc(c, 2) we are looking at original document. Whenever vc(c, 1) <> vc(c, 2) we are looking at amendment. Col 1 helps me keep track the original document. Cols 2 and 3 provide the details of the amendment.
I would like, upon each amendment to insert new line containing the details of the original document. here is an example of what I want to achieve (added row are marked up in red):
Orig Invoice | Secondary doc | Date | Column4 | Column5 |
VAL00002540 | VAL00002540 | 7.11.2017 | ||
VAL00002540 | VAL00002541 | 7.11.2017 | ||
VAL00002540 | VAL00002540 | 7.11.2017 | ||
VAL00002564 | VAL00002564 | 27.11.2017 | | |
VAL00002564 | VAL00002696 | 27.3.2018 | | |
VAL00002564 | VAL00002564 | 27.11.2017 | | |
VAL00002564 | VAL00002697 | 27.3.2018 | | |
VAL00002564 | VAL00002564 | 27.11.2017 | | |
VAL00002566 | VAL00002566 | 30.11.2017 | ||
VAL00002566 | VAL00002593 | 21.12.2017 | ||
VAL00002566 | VAL00002566 | 30.11.2017 | ||
VAL00002566 | VAL00002594 | 21.12.2017 | ||
VAL00002566 | VAL00002566 | 30.11.2017 |
<tbody>
</tbody>
this is how far I've reached, and I realise I am doing it totally wrong (it is part of larger code hence).
ReDim vg(1 To UBound(vc, 1), 1 To 10)
For c = 2 To UBound(vc, 1) 'To 2 Step -1
g = g + 1
If c = 2 Then
Else
If vc(c, 1) = vc(c - 1, 1) & vc(c, 2) <> vc(c - 1, 2) Then
vg(g, 1).EntireRow.Insert
Else
vg(g, 1) = vc(c, 1)
End If
End if
NextPlease help!