Here is a fully optimized version of your macro. :-O
Sub test()
End Sub
If only you had used your brain before programming, you should gave discovered that the problem is just about solving a quadratic equation.
I let you do the work of finding how to get the equation and the formula for solution.
Message to downvoter that don't give a solution:
Do the mathematical analyze and you will see that there is no need of a macro.
the solution is just 4 formulas (2 solutions and 2 variables) that fit in cells formulas.
And since this is Homework, just giving the full solution would earn me even more downvotes.