I don't think this makes sense in general. It's more effective to trade in whatever is profitable, then donate to causes you care about. Jim Cramer talked about investing in tobacco companies then donating his profits to antismoking charities.
First, not all types of “damage” and “repair” completely annihilate each other with no lasting effects. Protected areas like national parks are a great example of that. Donating to a charity that plants trees does not just “undo” investments in old-growth logging companies.
Secondly, the economies of scale that your tobacco company investments contribute toward may overwhelm the economies of scale that your charity donations contribute toward.
I don't think this makes sense in general. It's more effective to trade in whatever is profitable, then donate to causes you care about. Jim Cramer talked about investing in tobacco companies then donating his profits to antismoking charities.