Anas bin Malik reported,

Two men sneezed in the presence of the Prophet ﷺ. He invoked a blessing on one of them but not on the other.The man who was left out said, "Messenger of Allah, you blessed this man but did not bless me?"He replied, "This one praised Allah, but you did not praise Allah."

Azami 11293

Sahih

عن أنس قال

عطس رجلان عند النبي ﷺ، فشمت أحدهما، ولم يشمت الآخر، فقال الرجل: يا رسول الله شمت هذا، ولم تشمتني؟ قال: إن هذا حمد الله، ولم تحمد الله.

الأعظمي 11293صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Supplications, remembrances, and prayer upon the chosen Prophet ﷺ
Chapter
Supplications for various occasions
Section
Not saying "yarhamuk Allah" to one who does not praise Allah after sneezing
Numbering
Jami al-Kamil 11293 (2nd edition)