This paper presents a study about using computational tools applied to a particular problem of Mechanics of Materials. Our purpose is, on one hand, to solve a structural problem in order to teach the application of an optimization tool, such as Excel Solver, by means of the calculation of the minimum weight in a shaft. On the other hand, we present an active learning methodology based on the creation of spreadsheets that contributes to enhancing the motivation of students. Since the evaluation of the subject takes into account the activity of creating the spreadsheets, the academic results have improved considerably.