I thought I replied earlier but don't see it.
Tables and section breaks are very different from page breaks. Code does not address what you are trying to do.
You should not have to change the footer. Your page numbers should be set using Page fields, not typed directly into the footer.
Can you post a sample document (without proprietary info) that has the problem.
Sections / Headers and Footers in Microsoft Word 2007-2013