A proportion
[tex]a\div b = c\div d[/tex]
is nothing but a comparison between two fractions: we can rewrite it as
[tex]\dfrac{a}{b}=\dfrac{c}{d}[/tex]
So, we can multiply both sides by the two denominators b and d to get
[tex]\dfrac{a}{b}=\dfrac{c}{d} \iff ad = bc[/tex]
In other words, a proportion is true if the product of the inner terms is the same as the product of the outer terms.
In your case, we have the check is the following:
[tex]24 \div 40 = 4\div 7 \iff 24\cdot 7 = 40\cdot 7 \iff 168 = 280[/tex]
which is clearly false. So, 24:40 = 4:7 is not a true proportion. In fact, if we convert fractions into numbers, we have
[tex]\dfrac{24}{40} = 0.6,\quad \dfrac{4}{7} = 0.\overline{571428}[/tex]
which makes even more clear that the proportion doesn't hold.