Hi, Qasi!
Unfortunately your codesnippet (after some modifictions and adaptions) did not work properly! Obviously I made some severe mistakes and did not understand the VBA eventhandling and the InfoPath XPath expression evaluation very well. I designed a very simple form consisting of a repeating section including a repeating two column table. I put the VBA code into the changed event of the repeating section but the program (VBA debugger) crashed as soon as I wanted to enter some data into the repeating table telling me of an unallowed operation in the current status of the repeating section. The other two event classes crashed in the same way. I then put a copy-button in the repeating section with the "copy-repeating-table"-code. I entered data into the repeating table then inserted a new section and clicked the copy button. The effect was that the repeating section was generated exactly four times and each instance including the repeating table (with the formerly entered data, as desired!). I then tried to modify the for loop in your proposal with even more strange effects (only one repeating section instance but four instances of the repeating table in it). So, my opinion is that there is something wrong with the XPath-expression in my code. The datasource InfoPath generated from my design is as follows:
myFields
group1
group2
group3
group4
field1
field2
The VBA-code for the copy button currently (state of trial and error) is as follows:
Public Sub CTRL5_5_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
' Write your code here.
Dim i As Integer
Dim path As String = "/my:myFields/my:group1/my:group2"
Dim listItemNav As XPathNodeIterator = Me.MainDataSource.CreateNavigator().Select(path, NamespaceManager)
Dim nav As XPathNodeIterator = Me.MainDataSource.CreateNavigator().Select("/my:myFields/my:group1/my:group2[last()-1]/my:group3/my:group4", NamespaceManager)
'For i = 0 To listItemNav.Count
'listItemNav.MoveNext()
nav.Current.Clone().InsertAfter(listItemNav.Current)
'Next i
End Sub