All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
First of all, it should be noted that if the purpose of opening the Quran when one is unhappy is to see a good omen from it, then the scholars differed in opinion on this issue. For instance Ibn Al-'Arabi from the Maaliki school, is of the opinion that this is forbidden. At-Tartooshi from the same school, is of the same opinion while Ash-Shaafi’ee and others disliked it. However, Abu 'Abdullaah Ibn Battah is of the view that it is permissible.
Shaykh Al-Islam Ibn Taymiyyah said: 'One should not open the Mus-haf (Quran) in order to see a good omen, this is the view of a group of scholars contrarily to the view of Abu 'Abdullaah Ibn Battah.' Nonetheless, the most preponderant opinion is what Ibn Al-'Arabi and others said. If there was any good in doing this, then the Prophet and his companions would have done it. Besides, one might open the Quran to see a good omen while his eyes would fall on a verse that is contrary to what he aspires, like the following verses, Allaah Says (which means): {He [Allaah] will say: “Remain you in it with ignominy! And speak you not to me.}[Quran 23:108], or {They are far astray.}[Quran 14:3], so, he sees an evil omen, and this is forbidden.
Allaah Knows best.