All perfect praise be to Allah, and may His blessings and peace be upon Prophet Mohammad and upon his family and righteous companions.
If a Muslim intended to offer the reward of his good deed to Muslims, then it is valid, and the reward is attained by all Muslims, Allah`s willing, even if it was less than as intended to himself and to his parents. Aisha (May Allah be pleased with her) reported that the Prophet (PBUH) asked for a male sheep to offer as a sacrifice in EidulAdha. He said to her: “Aisha, fetch me the knife “ then he said: “Sharpen it with a stone “ then he laid the sheep down and while he was slaughtering it he said: "In the name of Allah, O. Allah, accept this sacrifice from Mohammad, the family of Mohammad, and the nation of Mohammad.” {Muslim}.
'Al-Imam Ar-ramli (May Allah have mercy on his soul) reported that:Al-Imam Al-Shafee ( May Allah be pleased with him ) said: "Allah`s Grace is so abundant that the charity giver is rewarded too. Fellow scholars said: "it is permissible for him to intend the reward for his parents, as an example, so they are rewarded and he isn`t deprived from the reward. The Shafite scholars were reported to having said: “O. Allah, offer the reward of what I have just recited to….in particular, and to all Muslims in general. Az-Zarkashi said: “The reward varies, the maximum is received by the one who offers the good deed in particular; whereas, the minimum is for the ones offered to in general.” [Nihayat-Al-Muhtaj]. And Allah Knows Best.