I'm not sure how you could end up with footnotes that aren't numbered seriatim, since Word re-numbers them if the add/delete notes in an existing sequence. That usually reflects some form of document corruption or the presence of cross-referencing to notes that occur later in the document.
If your document contains footnotes without endnotes, you could use the macro in
https://www.msofficeforums.com/word-...html#post47377 to repair a corrupt footnote numbering sequence. Simply convert the footnotes to endnotes before running the macro, then convert them back again afterwards.
To ensure any endnotes & footnotes occur before their cross-references, see:
https://www.msofficeforums.com/word-...html#post62674 &
https://www.msofficeforums.com/word-...html#post62738
PS: When posting code, please use the code tags, indicated by the # button on the posting menu. Without them, your code loses much of whatever structure it had.