Challenge - VBA Challenge #901 (Find if the number is even)
Starting a series of challenges on VBA. Will extend this to SQL, Excel, Power BI, Tableau. Feel free to drop in a solution in the comments.
The task here is to write a VBA code which should display an input box to accept a number as input. It should then evaluate if the number entered is even or not. For beginners I would suggest you to take a look at mod function in VBA. The best way to check it is to write small snippets of code like the below
Msgbox 5 mod 2
or in immediate window
?5 mod 2
See what is the result for this. The result would be 1 as that is the remainder when 5 is divided by 2. So, mod can be used in some way within an if condition to check if the number is even or not.
I guess its too much of details already. This is a very generic task and you can use any programming language you prefer. Feel free to put your code in comments for the discussion to get started.
So best of luck.