I would like to obtain by adding and subtracting histograms using the Add() function in the TH1 class. The operation is as follows:
hResult = h5 - h2 - h8 - h4 - h6 + h1 + h3 + h7 + h9

where h** are all histogram objects with same bin size. Could you suggest a macro on how to do this operation while preserving the poisson error from all the histograms in the resultant histogram hResult.

The Poisson error is computed from the existing histogram counts. If you add histograms and all contains counts, (i.e. are not weighted histograms), you will be able to compute the Poisson errors on the resulting summed histogram.

But he wants to substract one histogram from another, so even if it is integer counts, it might not work. I think then the only solution would be to keep track separately of the error using an auxiliary histogram where he sums all instead of subtract, and take that one as the error.

Sorry, I have missed the subtraction of histograms in the formula above. If you subtract histograms, then the resulting bin distribution is not anymore a Poisson distribution, it follows the Skellam distribution, so it does not make sense to compute afterwards Poisson statistical error. You can use in this case the normal approximation.
If you call TH1::Sumw2() on the input histograms, the resulting bin error after TH1::Add will be computed correctly (from the square root of the sum of the content instead of the subtracted one).