You could unlink the header or footer of Sections 5 & 6 from the previous Sections, then insert a SET field containing a SECTIONPAGES field in Section 5, thus:
{SET Sctn5 {SECTIONPAGES}}
after which you can insert a formula field in Section 6 coded as:
{={PAGE}-Sctn5 \# 0}
The numbering will now be correct - with one important caveat: A Table of Contents will not respect the calculated Page #s.
FWIW, your code might work better as:
Private Sub cmdSectionNumbers_Click()
Application.ScreenUpdating = False
Dim SctnA As Long, SctnB As Long, Fld As Field
SctnB = Selection.Information(wdActiveEndSectionNumber)
If SctnB < 3 Then
MsgBox "Selection in Section: " & SctnB & vbCr & _
"Must choose at least the 3rd section in the document." & vbCr & _
"Aborting operation.", vbCritical
Exit Sub
End If
With ActiveDocument
SctnA = .Sections(SctnB - 2).Range.Information(wdActiveEndAdjustedPageNumber)
With .Sections(SctnB - 1)
With .Headers(wdHeaderFooterPrimary)
.LinkToPrevious = False
For Each Fld In .Range.Fields
Select Case Fld.Type
Case wdFieldPage, wdFieldNumPages, wdFieldSectionPages: Fld.Delete
End Select
Next
End With
End With
With .Sections(SctnB).Headers(wdHeaderFooterPrimary)
.LinkToPrevious = False
With .PageNumbers
.NumberStyle = ActiveDocument.Sections(SctnA).Headers(wdHeaderFooterPrimary).PageNumbers.NumberStyle
.IncludeChapterNumber = ActiveDocument.Sections(SctnA).Headers(wdHeaderFooterPrimary).PageNumbers.IncludeChapterNumber
.RestartNumberingAtSection = True
.StartingNumber = SctnA + 1
End With
End With
End With
Application.ScreenUpdating = True
End Sub
Note, in particular, the code to delete page numbering from the intermediate Section.