 Hello everyone and welcome back to another video. This video is going to be first in a series that's looking at visual basic code. So we're going to be focusing on using visual basic within the Excel application. But as you're probably aware, visual basic can be used across the Office suite. So your Microsoft Word, Office and PowerPoint and so on and so forth. But our main focus will be obviously using Excel. And what we'll do is as these videos go on, we'll start looking at more detailed functions, what we can use visual basic for and how we can use it to speed up the processes and repetitive tasks that we have within the application. This first video is literally just going to be getting you started so you can understand how to open up the developer panel. And we can be writing our very first subroutine Hello World. So we'll basically get a message box to pop up driven by our code that will say a message of Hello World. And any of you who've done any sort of coding lessons before, you'll be aware that Hello World is a sort of industry standard first lesson when learning any new piece of code. So we'll jump straight in. So the first thing we're going to do is get the developer tab onto your Excel ribbon. So what I mean is we've got all the home insert page layout at the top here. We're also going to have an additional tab for the developer. And this is basically around all the visual basic. It's an actual extra menu that we have available to us. Like I say, that'll be important for using alongside visual basic. It will enable us to do things such as inserting buttons and so forth as we progress. In order to do that, all we need to do is go to file, go down to options. And obviously depending on what version of Excel you're using, the initial first steps might be a bit different, but it's the same buttons or locations you're looking for. And you should then get this Excel options pop up. What should then look more familiar again, depending on what version you're using. All we need to do is to go to customize ribbon down the left-hand side here. And as you look down the right here, down the main tabs, you'll ever see that there is the option of developer. And as you can see, it's currently unticked. So all we need to do is just tick that box, select okay, and you can see we've now got this developer tab added in at the top here for us. And if you click onto there, you can see there are a few different options in here available to us. Not to go into any of those at the moment because there's no point making this more complicated than it needs to be. The main purpose of this is to enable us to now open that developer panel. So as you can see within the developer tab, we have two options when opening up where we're going to enter our codes. You can even go onto visual basic. So just click there. And you'll see that this, if I put it onto the same screen, it might help. We can see we've now got this developer page. Where we're going to be entering our code in Excel. Alternatively, if you don't want to do that and you're someone like myself who prefers using the shortcut where available, all you need to do is hold the Alt button, push F11, and that'll bring that same window up for you as well. You can see that by look, it's again, based on version of Excel you're using, it may look like an older version of Excel we'll now be working with. You can see we've got our drop down menus at the top here, which we no longer have in Excel. But ultimately you'll see it looks like a bit more of a dated panel to work with. We'll go through more of the aspects on this page. Again, as we step through and they become more relevant. But most importantly, what you want to understand from this sheet is you can see we've got obviously our drop downs at the top end. So our labels to go into different options. This pit on the side here is our workbook structure. So this enables us to actually sort of structure and store our code and also you'll see the sheets within the workbook. You can see that all stored within a single folder. So you've got the Microsoft Excel objects there and you can see we've got sheet one because we need one sheet in our workbook and you've also got this workbook. So this enables you to again place your code in specific areas if required. But what we're going to do is we'll just be entering our code into a module. And this is sort of the standards practice we'll be starting with anyway. In order to do that, we can either right click basically one of the sheets, go down to insert and insert module. You can see we also have a class module and we also have a user form. Ignore those for now. We're just going to literally just be using the module option. Alternative to that, you could also go into the insert sheet, the insert tab at the top end and the same way just select module as well. And then once we select module, you can give it a double click. You can see that we are now within the, well it's a blank page, but we are now within this module and we can start entering our code. We also have some property information down the bottom here and this relates to the sheet or the module that you are selected. And if you were to go into say like sheet or this workbook, sorry, you can see there's a lot more detail going on here and the same for a sheet one. You can see there's some detail there as well. But again, sorry, I sort of digressed really. I sort of touched it without actually having much to say. So we ignore that for now and go back into module one. So in order to enter our code, we have to put all of our code into something called a subroutine and this is what Excel recognizes as containing our code. So to do that, we just need to enter the word sub and there was space and this is where we can now give our subroutine a name. So this can be absolutely anything and the best way to describe it is just to put something that is descriptive or you're about to understand as the code of what this code is relating to. So all I'm going to do for mine is simply put hello world and you can obviously do this in your lower case, uppercase or as I've done here. I'm just going to open and close brackets and as you'll see when I hit enter the subroutine part is recognized as being part of the code in Excel and also automatically as I hit enter, it also gave us this p-liner code here of end sub. So this is where we now need to make sure that any code we enter for this sub is entered between the top part, so the hello world and the end sub below. To make a code easier to work, we're also then going to just indent the foot next line. So all we need to do is hit tab for that and we're going to firstly put a message box, MSGBOX. So it looks like the shorthand for it but this is what Excel recognizes as a message box. So anything we enter into this will then give us a little pop up message box and display the text that we require. All we then need to do is do a space, quotation, enter hello world. Oh, if I could spell hello world. Close our rotations, hit enter and you can see that there, and this is always another good indication when you're working in Visual Basic that if it's a recognized function within the code, so like message box, you'll see it automatically recognize it and it will reformat to give the capital M and the capital B there. And that is just a good indication to know that your code has actually worked and been accepted. So once we've now got our code and this is the extent that we're going to put in, all we now need to do is push the play button to run that code. And you can see as soon as I've done that, we've got this pop up here, what says hello world. And to end that, all we need to do is do okay and it will take us back to our code. Alternatively, instead of pushing the button and if you want to do another shorthand shortcut, we need to do his hit F5 and you can see that you get that message box there again. So okay, and there you go. You just now constructed your first piece of Visual Basic code. And feel free to play around with this. You can put absolutely anything you want in here. You could put, I know, hello everyone. My name is Ben. So do that and then hit F5. And you can see how it's now updated to that. So what my advice would be now is just familiarize yourself with that piece of code and have a player around getting used to obviously entering different text into here and changing the name and also, you know, once you've ended in, delete it, see if you can now enter that back in without having to watch this video just so you familiarize yourself with how this basic code is formatted together. So thank you for watching that first video. Like I said, it's probably a bit very basic. Some of you might have already got a bit of experience doing this particular piece of code as it is. But what we'll be doing in the next video is we'll now start looking at other functions in the Excel code or in the Visual Basic code and we'll gradually progress getting more advanced as we go along. So to make sure you don't miss any of those other videos, do please make sure you subscribe to the channel, hit that bell notification and then you'll be notified of all of the new videos as they come out. And if you did like this video, it'd be greatly appreciated if you could like the video because it also indicates to me what obviously the content that you'd like to see and it does help with that all important YouTube algorithm. So thank you very much for watching and I shall see you in the next video. Before we go, don't forget to check out the other videos on our channel. You'll see everything from other functions and formulas through to tips and tricks. We've also created some playlists so you can see these categorized together. So make sure you check those out and get all those useful information. And obviously as always, don't forget to subscribe and hit that bell notification button.