Parshas Tetzaveh is the only Parsha in the Torah, after Moshe Rabeinu was born, that his name does not appear. The Zohar explains that this is not a coincidence. After Bnei Yisroel worshiped the Golden Calf, Moshe begged Hashem to forgive them. Moshe begged so strongly that he told Hashem that if He would not forgive Bnei Yisroel, Hashem should "erase me from Your books". Even though Hashem did forgive Bnei Yisroel, Moshe's words were so powerful that the curse that Moshe put on himself actually took hold and, therefore, his name "was erased" from our parsha.
Zera Shimshon asks why is Moshe's name not mentioned specifically in this parsha and not in some other parsha? How is the fact that Moshe asked to have his name erased from the Torah connected to Parshas Tetzaveh?
Zera Shimshon answers; the connection is that in this parsha Aaron was appointed to be the Kohen Gadol. Meaning.
It is written in Gemara Zevachim (102a); when Hashem appeared to Moshe at the Burning Bush (the sneh) to appoint Moshe to take Bnei Yisroel out of Mitzrayim, Moshe did not immediately agree, therefore Hashem punished Moshe. Moshe was meant to be the Kohen Gadol, but Hashem took away this right and made Aharon the Kohen Gadol in his place.
What was Moshe's reasoning not to accept the position to redeem Bnei Yisroel right away?
Zera Shimshon explains that Moshe knew if Hashem would redeem Bnei Yisroel without a middleman, the redemption would be complete and Bnei Yisroel would never have to suffer being in Galus again. Moshe felt the servitude Bnei Yisroel had suffered in Mitzrayim had fully purified them; therefore Bnei Yisroel deserved to be redeemed by Hashem alone and to be spared future galious.
Hashem however knew that Bnei Yisroel were not yet fully cleansed, and would need to go back into galus to finish the purification process. Therefore, Hashem wanted a mortal man, like Moshe, to take Bnei Yisroel out of Mitzrayim in order for the redemption not to be an absolute redemption in which Bnei Yisroel would remain tainted.. Bnei Yisroel needed to suffer more galious enabling us to eventually become totally pure.
If Bnei Yisroel would have never sinned after they left Mitzrayim, retroactively we would have seen that Moshe was right not to want to be the redeemer, and therefore it was not a sin that Moshe hesitated to lead Klal Yisroel out of Mitzrayim, and consequently Moshe should be the Kohen Gadol instead of Aharon. However, when Bnei Yisroel worshipped the Golden Calf we see the opposite; Moshe was wrong for hesitating to be the redeemer and Moshe deserved to lose the right to be Kohen Gadol and the proper person to hold that position was Aharon.
Since the same incident, the worshiping the Golden Calf, caused Moshe to daven not to be mentioned in the Torah and it also caused Aharon to be appointed to be Kohen Gadol, it is understandable why they both occur in the same parsha.
According to this we can answer another question. It is written in the Gemara that "a curse that is made by a Talmid Chacham on condition is effective, even if that condition is fulfilled". The Rishonim explain that this is true only if there is a smattering of an aveirah involved. If there is no aveirah at all, the curse will not take effect if the one who cursed fulfills the condition."
For instance, in the case that a person cursed himself that he will move out of his house if he doesn't pay his child's tuition, and in the end he did pay the tuition. If he wasn't wrong for not paying the tuition until now (he was away or sick in the hospital) the curse is not effective. However, if he was able to pay the tuition from the very beginning then the curse will be effective even if he does pay the child's tuition.
Regarding Moshe's prayer to be erased from the Torah, it would seem that Moshe did not transgress any aveirah when he davened for the forgiveness of Bnei Yisroel. This being so how can we understand why the curse took effect? According to the above, the explanation is simple; although at the time that Moshe davened he did not do an aveirah, however at that time it was retroactively made clear that Moshe did sin when Hashem spoke to him at the Burning Bush. It was this sin that enabled Moshe's curse to take hold.