 back to another video. So this video we're going to pull upon a couple of techniques we've learned in previous videos and we're going to be using VBA to help us create a very basic calculator. So what we'll be doing is we'll be using the input box method that we looked at in a previous video to be able to gather two pieces of information or more specifically two numbers from the user and we'll be building a basic calculator that will add those two numbers together and it will then paste the result into our Excel spreadsheet. So the code is going to look very familiar to what you've seen already but obviously it hopefully will help tie some stuff together to show you some actual real-world examples or real beneficial examples of putting the code and using it in Excel. So the first thing we need to do well actually we're going to do a lot as we progress along but we'll just jump straight in and obviously talk through the code as we do it. So as always we need to do our subroutine so we'll put it call it a simple calc for obviously simple calculator and we need to then define our two variables to start with. So we're going to have two which would be number one and number two or num one num two for short. So we do dim num one as integer and secondly we'll do num two as integer so because they're both integers and to sort of help tidy up keep our code nice and tidy we can code them on the same line as we've done here rather than doing a dim num two again on the second row. So we're defined both of our numbers as integers. So the next thing we now need to do is obviously set what value is going to be for each number. So the first one so num one is going to be equal to input box and for this we'll say tell me number one. Cool. So that first one is going to say tell me number one which in short basically says get getting the user to provide the first number and actually that's probably a better way of writing this. Just put first number and then for the second one we can then do num two is going to be equal to again input box input box and we'll do second number question mark close brackets and then once we've now gathered our two pieces of information so as the user is doing this they'll get the first input box they'll put a number in they'll then having submitted that they'll receive a second input box to provide the second number. So the next thing we now need to do is create a third variable what's going to be our answer. So you don't have to do this but I just like to stick with this process because it helps again keep everything nice and tidy. So report calc result is equal to num one plus number two and then simply all we're going to do with that is we'll then go into our file and we'll put let's say sheet or sheets so we want to go into sheet one we then want to go into the cells of one one and the value is going to equal, focus on the equal sign calc underscore result as simple as that. So again just to step through this we've defined both of our numbers as integers so whole numbers no decimal places we're going to have a pop-up box what will give us obviously the ability to store the first number and then the second input box will then give us the ability to store a second number. Once both of those variables have been captured we can then obviously get our last result here and we'll understand or they do the calculation of number one plus number two what will be stored as calc result and then lastly we're defined where we want to paste the value and obviously this is defined here so this first cell in column or cell one row one of column one and obviously that the value of that is going to equal our result. What we can just do lastly again is put another developer tab and do it insert a button and we'll do that we'll also assign it to the simple calc subroutine and let's just rename our button to calculator like so. So what we don't need to do is just simply run our code so when we click our button you can see we get our first input box and as we wanted it says first number question mark so we can now provide a number let's go number five as we click okay you can see that their first input box was closed and then replaced with our second and so that first number has now been stored in our variable of number one we're now gone to our second number here so let's do five again and do okay and upon doing that you can see that five plus five is obviously ten and that has then been stored into our cell cell one at the top here so we've been able to just create our very simple calculator what we can do is just to play around with this bit more so touching on a couple of extra bonus things here is when we're actually putting this value into our cell at the moment obviously just says the number ten what we could do is add a bit more text here using the sort of the strings and let's say we wanted to say the result is and then what obviously the result is so all we now need to do here is in quotations we can put the calculator result is just a little colon and do a quotation so you can see we've done these two quotations obviously telling it its string and I've just included the space at the end here just so there is a space between our string and the result and lastly I was going to do an and symbol after our little custom bit of string and the calculation just to stick it all together so if I was to now run this again let's do this time first number is ten and the second number is two and do okay you can see that we now have a nice bit of text here will actually instructs the user what they're seeing and obviously they know that number is obviously the result of the calculation and it now says the calculator result is 12 which we know is ten plus two so for this basic calculator with that we've used the plus if we want to change it and make it either multiplication division or subtraction all we need to do is just change this symbol in here and let's go for multiplication this time so let's change that into a multiplication or multiplication if I can say it so this time if we do our calculator select calculator and we'll do five there's a first number we'll also do five as the second number select okay and you can now see our result is changed to 25 and again we're still got that text in there just to show the user what they're actually seeing because obviously we're always referencing that same cell of cell 11 obviously the value is always going to override whatever the previous value was so there you go we've just now completed our first actual process and created a very basic calculator using Excel VBA as we go through there's a couple of little bits we need to go over in in separate videos but we'll eventually look to build a dynamic and obviously more advanced calculator than this one and we'll be doing that I'll say in a future video so make sure you stay tuned for that to ensure you see that video when it does come out because that will be a good one do ensure that you are subscribed to the channel and you've got that Bell notification clicked so you're notified as soon as that and our other videos come out if you did enjoy today's video please don't forget to give the video like it is it's greatly appreciate by me and obviously helps that all important YouTube algorithm and also just make sure that other people are able to see this video and learn something new if they weren't already aware of it if you do have any questions as always please just drop a comment below this video and I'll get back to you as soon as I can and lastly thank you once again and we'll see you in the next video