Yes, there are other ways, including macros but I'm not about to write another one without knowing the context and being given information piecemeal. FWIW, if the numbers are part of automatic numbering, cross-references or other fields, a completely different approach would be required.
For an example of what's possible, see:
https://www.msofficeforums.com/word/...html#post74812
https://www.msofficeforums.com/word/...html#post16171