A possible solution is:
10 8 3 21
12 15 14 2
1 7 30 24
42 6 4 5
Strategy
$$5040=2^4 \times 3^2 \times 5 \times 7$$
First I decided where to put the multiples of $7$ and $5$. Then I multiplied proper exponents of $2$ and $3$ to each cell. I started with:
5 1 1 7
1 5 7 1
1 7 5 1
7 1 1 5
This formation ensures that the number of cells without a $5$ or $7$ stays minimum. There are other such formations. But this is the most simple.
Now, There are eight $1$'s, four each of $5$ and$7$. When adding exponents of $3$ my strategy was to half each number of repeatation. A simple pattern was:
1 1 3 3
3 3 1 1
1 1 3 3
3 3 1 1
Multiplying by this grid the previous one, we have:
5 1 3 21
3 15 7 1
1 7 15 3
21 3 1 5
Now the repeatation pattern was like this (same color represents same powers of $3$, $5$, $7$ in factorization):
For any two cells with the same color I had to differentiate them by multiplying different powers of $2$. Note the red and yellow cells. There are four of each. Hence I needed at least four different powers of $2$, $2^4$ couldn't be chosen because putting $2^4$ in a red or yellow cell, forces two cells of the opposite color to have same powers of $2$, hence be same. So, the four red and yellow cells had to be multiplied with $2^0, 2^1, 2^2,2^3$ A bit of fiddling led to the pattern:
2 8 1 1
4 1 2 2
1 1 2 8
2 2 4 1
Multiplying by this grid, we get the desired solution.