By dedicating all the virtue generated from a positive deed for the benefit of others, the virtue remains with you.
Geshe Gelek at the Instituto Lama Tsong Khapa, offered a beautiful analogy. He compared virtue to a drop of water saying “…a drop of water in the ocean becomes inexhaustible as long as the ocean remains. It is no longer a single drop of water that immediately evaporates. Similarly when one dedicates even the smallest virtue to achieve enlightenment for the benefit of all sentient beings, it is like putting a drop of water in the ocean; that virtue will not be exhausted until you achieve supreme enlightenment. No matter how much you use the benefit arising from that particular virtue, it becomes inexhaustible. This example is very beneficial.”