Hello,
Please find below example of the document I work on.

1. I would like to have some macro cross checking if all the source codes (i.e. [X.1],[X.2] in the example below) listed in the text body (they will be always in brackets) are present in the table with the source name and if no – I would like the macro to add comment to the missing code i.e. “add the code to the table” or alternatively - mark that missing code in any other way i.e. highlight with red. In that particular example comment should be added to [X.4] in Subchapter 1.1 and to [X.3] in Subchapter 1.2.
Example - structure of the document:

1.Chapter 1

1.1.Subchapter 1.1.

Face masks are no longer mandatory in shops and on public transport (see [X.1]), limits on gathering have gone and the work from home guidance has ended (see [X.2]).
Nightclubs, theatres and restaurants can fully reopen (see [X.3]), while pubs are no longer restricted to table service only (see [X.4]).
X.1 Source 1
X.2 Source 2
X.3 Source 3
X.7 Source 7


1.2.Subchapter 1.2.

But with COVID-19 cases continuing to soar (see [X.4]) and renewed warnings about the pressure on the NHS (see [X.2]), the prime minister urged people to “go forward into the next step with all the right prudence and respect for other people” (see [X.3]).
X.2 Source 2
X.4 Source 4


2. It would be ideally to do the check the other way round - if there is some code in a table (example: X.7 in table Subchapter 1.1.) not present in the descriptive part of particular subchapter - mark this with comment/highlight with red.