Ecclesiastes 7:14

14 When times are good, be happy; but when times are bad, consider this: God has made the one as well as the other. Therefore, no one can discover anything about their future.

Read Ecclesiastes 7:14 Using Other Translations

In the day of prosperity be joyful, but in the day of adversity consider: God also hath set the one over against the other, to the end that man should find nothing after him.
In the day of prosperity be joyful, and in the day of adversity consider: God has made the one as well as the other, so that man may not find out anything that will be after him.
Enjoy prosperity while you can, but when hard times strike, realize that both come from God. Remember that nothing is certain in this life.