Choose your language

Even and Odd

Intermediate Exercise


Statement

Create an InputBox that will insert all inputted values into column "A" of the current worksheet (one line for each input). Make it so that it only allows the input of integer numbers (does not allow the input of non-integers or of non-numeric values). Additionally, create a Sub to transfer all even values above 42 into line 1 of the "SVBA_Export" worksheet, organizing them in ascending order. This subroutine should also calculate the square of all odd numbers inputted and organize the results in line 3 of the "SVBA_Export" worksheet in descending order. The InputBox should stop collecting data if the input is left in blank and the "OK" button is pressed.


Suggested Concepts:

Remember that in most cases there is more than one way to solve the exercise.

Hint: Create a loop within another. If the variable of the second loop have a higher value than the variable of the first, substitute the variable


Show Answer

Download exercise Download answer



SuperExcelVBA.com is learning website. Examples might be simplified to improve reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. All Rights Reserved.

Excel ® is a registered trademark of the Microsoft Corporation.

© 2019 SuperExcelVBA | ABOUT

Protected by Copyscape