Ecclesiastes 2:21-26

Ecclesiastes 2:21
For there is a man whose labour is in wisdom, and in knowledge, and in equity; yet to a man that hath not laboured therein shall he leave it for his portion. This also is vanity and a great evil.
Then Solomon bemoans the fact that a man, maybe he speaks of himself, whose labor was couched in wisdom and knowledge and in equity which carries with it the meaning of success in his skills.  This man built great things and was successful in all his endeavors.  All the buildings and completed projects will have to be left behind to someone who did not even partake in the actual process of building the realm.  Basically Solomon sounds like he would like it if he could take everything with him which is an impossibility. For we brought nothing into this world, and it is certain we can carry nothing out.  (1 Timothy 6:7)  The idea that someone other than the one who had success in business would be the recipient of all they built just by means of being in the family or a will naming someone else is vanity and evil in the sight of Solomon.  This is the pitfalls of life.  Someone may build a successful business and leave it to a family member only to find out how incompetent that person is and in a few years the business has completely failed.
Ecclesiastes 2:22
For what hath man of all his labour, and of the vexation of his heart, wherein he hath laboured under the sun?
A man labors all his life and suffers all the injustices of life which has vexed his heart and spirit and based on this what advantage does a person have who has worked hard all their life?  What do they have to show for it since hard work was the penalty for the sin of Adam and Eve.  In the sweat of thy face shalt thou eat bread, till thou return unto the ground; for out of it wast thou taken: for dust thou art, and unto dust shalt thou return.  (Genesis 3:19)  How many times we read about a person who has worked hard all their life and then a month after they retire, they die.  What did this person have for all those years of toil and hardship?
Ecclesiastes 2:23
For all his days are sorrows, and his travail grief; yea, his heart taketh not rest in the night. This is also vanity.
For all the days of a person’s existence on earth is filled with both grief and pain as they work all day and then when they come home to rest at night, they are unable to find physical rest and also emotional rest as they worry whether they will have a job tomorrow or will something happen that will change the course of their life for the worse?  Fear and perplexity will plague them in the night.  Solomon also sees this scenario as emptiness or vanity because it is a cycle which continues until death.
Ecclesiastes 2:24
There is nothing better for a man, than that he should eat and drink, and that he should make his soul enjoy good in his labour. This also I saw, that it was from the hand of God.
Void of having the Lord as your Savior, the only thing that man can enjoy under the sun is that to use some of the money which they have labored for to buy not only the necessities of life but also to spend it on the enjoyments of life which is not sinful to do if you spend it on things that are good for you such as going to the park, maybe taking a vacation, having a hobby, bicycling in the country or just walking with a good pair of walking shoes.  The Lord did give us many things on this earth to enjoy, almost every country in the world has places where people can visit and enjoy themselves such as the fiords in the Nordic countries, the outback in Australia, the beautiful mountains and shorelines of New Zealand, the national parks here in the USA, safaris in many countries in Africa, the gorgeous Canadian Rockies, etc.  People can always find something good for them and can stay away from booze and drugs which will kill their bodies.
Ecclesiastes 2:25
For who can eat, or who else can hasten hereunto, more than I?
Then Solomon compares the ordinary person who does not share in the extent of his wealth.  Solomon is stating that he has tremendous wealth and can have anything and do anything he wants.  If he finds even the naturally beautiful things of the earth to be something that is vain, then how much more does the person who labors daily for their provision would also find them vain since their small finances would limit their ability to enjoy the things of the earth.  By Solomon asking the question in this verse, he is also stating that he has better understanding of all the vain things of the world because of his immense wealth and the ability to enjoy anything he wants.  Even the pleasures of this world become rote.
Ecclesiastes 2:26
For God giveth to a man that is good in his sight wisdom, and knowledge, and joy: but to the sinner he giveth travail, to gather and to heap up, that he may give to him that is good before God. This also is vanity and vexation of spirit.
Here Solomon makes a distinction between those who are saved and those who are not.  God gives to his children wisdom, knowledge and joy.
Wisdom - If any of you lack wisdom, let him ask of God, that giveth to all men liberally, and upbraideth not; and it shall be given him.  (James 1:5)
Knowledge - And have put on the new man, which is renewed in knowledge after the image of him that created him:  (Colossians 3:10)
Joy - Then he said unto them, Go your way, eat the fat, and drink the sweet, and send portions unto them for whom nothing is prepared: for this day is holy unto our Lord: neither be ye sorry; for the joy of the LORD is your strength.  (Nehemiah 8:10)
Then the earthly plight of the unbeliever is that they are given travail which carries with it the meaning of “employment or occupation.”  He will gather up goods and money during his life but not to enjoy it but only for the purpose of leaving it to others.  Let us look at Proverbs 13:22:
A good man leaveth an inheritance to his children's children: and the wealth of the sinner is laid up for the just. (Proverbs 13:22)
Here we have a verse which carries with it a spiritual and physical aspect. The physical aspect is that a good man who has accumulated wealth through hard and legitimate work is able to leave an inheritance to not only his children, but to his grandchildren. Then the unbeliever who has gained wealth will lose all of it upon death and somehow it will be given to the believers, who are the just. And he said unto them that stood by, Take from him the pound, and give it to him that hath ten pounds. (Luke 19:24) In the parable of the Pounds in Luke 19, Jesus tells of a nobleman who gave three of his servants ten, five and one pound respectively. The ones who were given the 5 & 10 pounds had doubled the amount and both were rewarded accordingly. However, the steward who received the one pound did nothing with it and his reward was to give that pound to the one who had ten. So what he had, was taken away from him and given to the one who was able to double the ten pounds. So here we have an example of the wealth of the unbeliever given to the believer by the Lord Himself. For unto every one that hath shall be given, and he shall have abundance: but from him that hath not shall be taken away even that which he hath. (Matthew 25:29) The Lord is basically showing us that diligence in vocation will have its reward. A lazy individual in business may have a high position and maintains it not by his own merit but by the merits of others. Along comes a diligent worker and their diligence is seen by the higher ups and they decide to replace the lazy individual with the diligent worker. The lazy individual loses everything and the department that he managed was now given to another.
Let us look at the spiritual aspect of this verse. A believing man, will not only train his son in the ways of the Lord but will also train his grandchildren in the ways of the Lord by imparting the wisdom of Scripture to them. He may also have prayed thousands of times for his son and also his grandson and those prayers will have a lifelong effect upon the grandchildren, long after the grandfather has gone to glory. And another angel came and stood at the altar, having a golden censer; and there was given unto him much incense, that he should offer it with the prayers of all saints upon the golden altar which was before the throne. (Revelation 8:3) In the second part of this verse it speaks of the wealth being given to the Just. Here we see a person who has a ministry but is unsaved. He brings the gospel but he does not have the Holy Spirit and he is not supposed to be in ministry anyway, probably doing it for a job. {16} But unto the wicked God saith, What hast thou to do to declare my statutes, or that thou shouldest take my covenant in thy mouth? {17} Seeing thou hatest instruction, and castest my words behind thee. (Psalm 50:16-17) The unbeliever wants nothing to do with the true Gospel since in his case it is self-convicting. So they make up a peripheral gospel which is based solely on a false love which keeps everybody happy but still in the dark. Then one day God removes this person and sets up a true believer in his place and all the wealth of those souls who were partakers of that false ministry will be transferred to the new preacher who will preach the truth. As God raises up kings and brings them down, He also removes preachers and raises them up.