It's not clear what you are trying to do. You seem to be putting the
results of calculations into cells in the spreadsheet. This is what you
would typically want to do.
However, you are also declaring a set of variables (A, HI, etc) in two
modules. This means that you will have two of each variable - and they will
be separate variables.
If you want to have global variables (and you shouldn't really), then they
must be declared only once. The declaration should have Public, not Dim,
and the references to them from the other module should be preceded by the
module name and a dot.
E.g. in module AA you have Public XX as Integer. In module AA, you can then
refer to XX as XX. In module BB you refer to it as AA.XX so that Excel
knows where to find it.
This "dot" notation is always the best thing to do. However, in some cases,
Excel doesn't require it and will just find the public variable anyway -
provided there's only one with that name. But please use dot notation -
it's easier to debug.