Learn Excel VBA UserForms Project #1 | Kyle Pew | Skillshare

Playback Speed

  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x

Learn Excel VBA UserForms Project #1

teacher avatar Kyle Pew, Microsoft Certified Trainer

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Watch this class and thousands more

Get unlimited access to every class
Taught by industry leaders & working professionals
Topics include illustration, design, photography, and more

Lessons in This Class

    • 1.

      Excel VBA UserForms Project #1 Intro


    • 2.

      Creating an Excel VBA UserForm


    • 3.

      Adding Controls to the Excel VBA UserForm


    • 4.

      Modfying UserForm Control Properties


    • 5.

      Working with Excel VBA ComboBoxes


    • 6.

      More Excel VBA ComboBoxes


    • 7.

      Setting Default Values of Controls on a UserForm


    • 8.

      Adding VBA Code to a Button on a UserForm


    • 9.

      Creating a VBA Procedure to Display the UserForm


  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.





About This Class


Project #1 of the Learn Excel VBA UserForms course will introduce you to the basic concepts of creating and writing code for Excel VBA UserForms. Some of the key Microsoft Excel VBA UserForm concepts you will learn include;

  • Creating a VBA UserForm
  • Working with UserForm Controls
  • Adding Code to VBA UserForms and Controls
  • Displaying the UserForm to the user

Start your journey into Excel VBA UserForms by build a solid foundation in this course. Next steps, look for the my additional Excel VBA UserForms courses to continue your journey.

Meet Your Teacher

Teacher Profile Image

Kyle Pew

Microsoft Certified Trainer



Kyle is a Microsoft Certified Trainer (MCT) and a certified Microsoft Office Master Instructor and has been teaching and consulting for the past 10+ years on various computer applications, including;

Microsoft Office Suite 1997, 2000, XP, 2003, 2007, 2010, 2013 Excel, Word, PowerPoint, Outlook, Access and Visio SharePoint End-User 2007, 2010, 2013 VBA (Excel and Access) Adobe Suite Photoshop, Illustrator, InDesign Maya (Modeling and Animation) Unity3d (Game Design) HTML, CSS and JavaScript Crystal Reports

Kyle is a graduate of the San Francisco Art Institute in the Media Arts and Animation Program. He has worked as a Game Designer for Electronic Arts, designing on games such as Nerf N-Strike, Nerf N-Strike Elite, both for the Wii, and a Sims 3 Expansion ... See full profile

Class Ratings

Expectations Met?
  • 0%
  • Yes
  • 0%
  • Somewhat
  • 0%
  • Not really
  • 0%

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.


1. Excel VBA UserForms Project #1 Intro: welcome to project one of this XlV Be a user forms course. Now, before we jump in and start to build this project, I want to give you a really quick peek at what this project is all about. Introduce you to the user form that you'll be creating during this portion of the course. So take a look open in front of you. I've got a completed version of project number one. What you're going to dio is you're gonna create a button. It's called Add new Call log. And when you give this button to click, this is gonna execute an XLV. Be a procedure that's gonna open up a form that you're going to eventually use for data entry inside of an Excel workbook. Take a look. I'll give that button and click. This is gonna open up the form that you're about to create, and you're gonna understand what forms you're all about. How the layout of form, how to create a form, how to use different controls, things like tax boxes and command buttons and combo boxes and check boxes. All of these very common types of controls that people use un excel vb a user forms. So this is what you're about to create. Let's jump in and let's start building this user form. 2. Creating an Excel VBA UserForm: So the first step in building an XLV be a user form is to create the form essentially the foundation. This is just going to be an empty form that we're gonna build inside of RV. Be a project. Take a look. So my first step is I need to open up the visual basic for application window. I can do this one of a couple different ways. A short cut key Ault the altar key on your keyboard and the function key F 11 Ault F 11. This will open up the visual basic for application window Mind popped open on my other screen. I'll drag it over here and here's the V B a window. Ault F 11 is your shortcut key. Now with in here, I can see that there is a reference to my VB a project for my call center log 01 This is the example file that comes within this course within this project. So I've got that open. I've opened up my vb a window and within there you can see all the various objects that make up this workbook. Now I want to build a user form within this project. Really simply, I'm gonna go to my insert menu and I'm going to choose user form. This creates a brand new VB, a user form for me there. It is kind of just a dotted grid there. It's called User Form one, and I've got this little toolbox, but this is just a blink user form. Now I'm going to start adding controls to this form. But even before we do that, let's take a look at what the user would see if we were to publish this form, just as it ISS with the form selected in the V B a window, I'm going to go up and click on the play button or the little run sub procedure user form button. I'll give that a click. This triggers the events to build. Open up that form, and here it is. It's a nice little windows form within Excel, a simple blank form. So there you have it. You've created your first XlV. Be a user form. It's that simple. Within your VB, a window insert user form, you've got it. Now let's start adding controls to this form. But before I demonstrate that, build yourself your own little user form 3. Adding Controls to the Excel VBA UserForm: Now let's start building out the actual form with each of the controls on there and we're gonna take this a step at a time. We're gonna build the form, get all the controls out there, and then we'll jump in and start to manipulate each of these controls, changing their tax, their properties and so on. So first, let's get the layout of the form with each of the controls. So with my new user form selected, I got my toolbox. Now, Justin, F Y I if your toolbox goes away, if I close that, it's just this little button up here at the top on my VB A menu bars is my toolbox. I also want to point out if I click away from the form to say I go quick and something else here, that little box goes away. If I go back to the form, I get the toolbox back. Simple. But just in half, why I heads up that Hey, if it disappears on you, you got ways of give me the back. So first I'm gonna add all my text boxes and my combo boxes and my check boxes out here on my four So from my toolbox, I'm gonna grab the text box control. It's the little Abie pipe. Don't give that a click. I'm gonna hop out to my form and I'm gonna left, click and drag just to create a little text box year. Now, that's just one little text box that's gonna that's gonna act like the start time entry of the call log. Now I'm with that box selected. I'm just gonna copy that and paste it in. Give myself another one here and I'm gonna paste again. I'm just gonna create a couple of text boxes here, and I've got this vision in my head where I'm gonna have the start, call time, the in call time, the call of the date of the call. And let's do one more here, This one. I'm gonna make a little bit bigger, so I'm gonna select my form and just pull on that a little. I'm gonna make this one a notes box. I'm gonna make that one actually quite a bit bigger here. Let's say let's go right about there. That will be a place for people to leave notes about the calls that take place. So four little text boxes out there getting the little A B box and you can click and click and click and click. Or I just copied a piece that created one of them Copy paste resize, move them around and so on. Now I'm going to create a couple of combo box controls that's just right next door to the text box. 1st 1 I'm gonna create here. This is gonna act as a type box. I want to know the type of call that were logging here. Eso That'll be one. I'm gonna create another one. Copy pastes just down below this one will be for the employees I want. People will pick a drop down, pick a pick a list of employees from here. And I'm just getting a little more particular him is gonna move these scenes around, get a little bit more space in there. I won't worry too much about this right now. You can increase the form size and I knew those around. I'm not gonna worry too much about getting it perfect, but now I got a little bit more space between those controls. Give me some breathing room and later on, when I start adding labels into here. Got some space to put labels. Now I need a check box. I'm gonna grab the check box control here, and I'm just gonna click right below my notes box. Here's a nice little check, Mark. There we go. That's gonna be a check mark for users to check. If the call or the purpose of the call has been resolved, they actually help the customer that called in or that the employee called. And I've got four little text boxes to little combo boxes and a check box. Now, I'm gonna use one more control here, and I'm gonna create a couple of buttons. We'll create a button to submit the form. And I'm just gonna copy paste. We'll create one for clearing the form copy paste. And I'm going to create two little ones year that are gonna act as buttons to populate, copy, paste toe, populate the beginning time of the call and the end time of the call. I'm going to give users a button to build a press, to build a to populate those two boxes with the with the appropriate times. So simple little form. I've got some controls out there. I've got some buttons out there in a check box. Now, I'm gonna do one more thing here. I'm gonna create some labels, So I'm gonna use the big capital a there and labels, Really? Just a nice little label. So people know what these controls are all about. All right. So I'm just gonna copy and paste these scenes around just to put some labels next to each of these boxes. And again, Copy Paste is your friend. You can keep dragging him out of there, just creating new boxes. But once again, just copy pastes. Make it quick and easy for yourself. So once again, got the beginnings of my form, laid it out, just using my nice little toolbox year and a handful of controls. Now, once again, we're definitely not done right? I've got some cleanup work I need to do here. So some re labelling of things and changing some properties that we're going to talk about next. But let's see what we got so far. I'm gonna go hit the little play button again. And here's the beginnings of my user form. Got all my little text boxes in there. My combo box is a little drop down Menus that check box and some buttons. Currently, the buttons don't do anything for me giving those a click, but they will eventually when we start writing the code here. So trade this out, get your form in there. That's what we did in the prior video. Then start adding your controls to the form. Don't worry about too much about look and feel just yet. You can move them around and give them the sense of layout. Resize them a little bit in one nut. But just get the controls out there. Get the buttons that text boxes, get the labels out there. Once you got all that, all those controls laid on on the form, then we're going to take a look at properties of the controls, re labeling them captured and given them names than any other properties that we want to take a look at. So try this out first and then jump into the next video 4. Modfying UserForm Control Properties: So now that we've got the form laid out, all the controls out there, I want to start getting into the properties of these controls, giving them names that we can use inside of our code, re labeling things so people can actually see what these controls are all about. So I'm gonna go ahead and close my form here. This will take me back into my vb. A window where I can see my new user form. If you're form wasn't open. Remember the shortcut key Ault F 11 take you right into the V B a window. You'll find your forms on the left. You give user form one and double click that will reopen your form. So now first I want to relabel some stuff. One. I want to relabel the form because currently at the top, it just says user form one. Well, I'm gonna make sure my form is selected. Then I'm gonna go down into my properties window, which is down the left hand side. Now, if that is not open for some reason, I close that poof gone. Well, how do you get that back if I go to my view menu top of the screen. I'm going to reopen the properties window there. It iss just pull that upset to see some more here. So first I'm gonna rename it. I'll give that a double quick rename, and I'm gonna call this FRM not call center form. Great. Now, I also want to re caption it another one of the properties here. The caption is what's gonna show up at the top of the form? The name what I just did There is what you're gonna use inside the code portion of your form. So I'm gonna re caption it here. We'll call this call center form. There it is. I've just re captioned my form. Now I'm gonna go through and do the rest of my controls Here, let me to grab my label here. This will be Ah, Let's see, Caption. I'm gonna relabel this one as start time. I'm gonna grab the next label called this one in time and in time. And let's see, I'm just gonna go through and relabel each my controls here. This one is called notes and then I've got once this one here causes the cult type. Then I've got the called dates the date of the call. I've got the employees, and here this check box recaptured. Now, when this one's gonna be called resolved, I want to know whether or not the issue was resolved or not. So now it's starting to look more like a form, right? I'm gonna hit the little play button here really quick just to see. And I've got nice little labels out there just labelling out this form is looking pretty professional. I'm gonna go and close that again. No, I want to keep going here. I wanna recaptured my buttons. We'll call this one submit and this one over here, we'll call this one clear. And for these two little buttons here, I'm just going to put an ass strict on, um, these are gonna be buttons that when users click on, um, it'll auto populate the start time and the end time. As soon as they cook on the buttons, those those things will happen for us. Alright, So I've started labelling my controls. You're just using some of the properties using the caption property. Now if I go back in and grab each of my text boxes and combo boxes and so on. I want to rename those cause I'm eventually gonna use these controls inside of my code. So I'm gonna grab my first text box there and this one I call txt. It's a tax box. Start time and it's even one right next door to is gonna be txt in time and so on. I want to go through and I want to rename each of the controls here. Name them appropriately so that when we start coding that we can reference thes controls by their name, So I'm just do another one here again. Select the control. Get into the properties of someone will be txt, call notes and so on. I want to do that for the rest of the controls. So I'm gonna encourage you. Get your form, get your controls out there, relabel your controls and get in and name each of your controls. 5. Working with Excel VBA ComboBoxes: So the next step that I want to take here after we've created the forum out of your controls and given names and captions toe all your controls, we're now going to start to add the code. Really? The magic that makes this form do its job. And the initial code that we're gonna put in here deals with an event of the form. I want to get the form set up and ready to be used. Let's take a look at what it looks like right now. If I select the form, I'm gonna go hit the play button inside my vb a window little green arrow here we got my form all nice and pretty and labeled and so on. I think I want to make that call notes box a little bit bigger. But right now, if I go to call type er employees, I got nice little drop downs there combo boxes. But there's nothing in them. I want to populate those combo boxes with some initial values, different call types and then pull the names employee names based on the sheet names down below. I got four employees here, so I'm gonna close that. Give me back into the V B a window. And now, as soon as somebody opens the form I want those two combo boxes toe have their values already. So in order for us to get into the code, I'm gonna double quick my form just someplace inside the little dotted grid. This brings me into what's called code behind. This is where the code resides within the form. Now you can see that it's given me by default a private sub procedure based on the user form and the click event. Remember, I got into the code by double clicking the form. So anything I put between this private, southern and sub would take place when somebody clicks the form. Well, that's not what I wanted happen. I'm gonna change it. I don't want click, You see? Click up here at the top. I mean, a change it from click. And these were all these events that deal with the form. I'm gonna change it to initialize. So when the form is opened, when it's initialized, I'm gonna get something happen. And in this case, what I'm gonna have happen is when somebody opens the form, it's going to give them. Some options inside of those drop downs were essentially gonna populate the combo boxes with its values. All right, take a look. So I'm gonna jump into initialize area, and I want to add some call types to the call tight menu. Well, in order for me to build add values to the call type combo box inside a code, I have to make reference to that combo box. So for me, I'm gonna say me dots and I'm gonna go find the Let's. See, it was combo box. Actually, it's going to be don't CBO call tight. So me refers to the form itself to the user form dot On that form, we have a control accounts, CBO call type, and I'd like to add some items to that drop down menu. So I'm gonna say I want to add an item of Let's see. I want to say payments. One call type will be customers. You're gonna want to make payments. Let's do this. Let's do a few more here. I'm gonna copy and pastes. Let's do like a total of four here. I'll say CBO call typed out at items that a payment will say registration Let's say we'll do it. One for updates and we'll do one for a cancel type as well. So I've now when the form is initialized or when it's opened, we're gonna make reference to the form me refers to the form itself dot Get into the specific control dot Get into a method of that control, something that we can do with that control. In this case, add an item to it and we're gonna add four things to it. So let's see what we got here. I'm gonna go back into my project window. I'll give my format for him call center for mid DoubleClick and makes you ensure that it selected there. I'm gonna go hit the play button. I got my form. And if I go to call type my little drop down, there's my four options. So on initialize on opening of the form. Let's populate the call types with its specific values. Try this out. Get in your form, give the former double click. Let's change it from the clique event to the initialize event and using the ad item method of our specific control on our form, start adding some values. Try this out 6. More Excel VBA ComboBoxes: So I want to continue adding some predetermined values when the form is initialized or when it's opened to the combo boxes of the form. Let's just take a quick peek of the form. Once again, I'm just gonna go hit the little play button there, reopened the form we just set up in the prior video, the call type values. Now I want to populate the employee values. Well, the employee values for the combo box employees are gonna come from these four worksheets. So rather than me spelling them all out individually, we're going to get a little bit of CO. Just a couple lines of visual basic toe. Look at our four worksheets and populate the combo box based on the names of those four worksheets. Watch this. I'm gonna close the form. I'm gonna get my form a double click. Bring me back to my user form initialize event, and I'm gonna modify a little bit of code that I have here. We're going to create a loop, and this is gonna be a really simple loop. I'm going to use what's called a four next loop, then this loop is going to go through each of the employees worksheets grabbed their names and populate the combo box. Take a look. So my first step here, I'm going to create a variable and this variable I'm gonna call I and it's gonna be a type integer So I've now got this little variable This storage location called I that's going to be storing a numeric value, an integer Now for my loop again, I'm going to use what's called a Ford next loop. I'm gonna say for I equals two to I need to tell how many times I want something to happen . I want it to happen from two to so many times. How many times do I want to have happen while I've got four worksheets for employees worksheets So I could say, Hey, I want you to loop from 2 to 4 times and you're gonna do something. This the basics of our four next loop for I, that's the integer variable storage that stores in numeric value the first time the loop runs its equal. That too. And then it's gonna do some stuff and then go the next I, which would then increment I 23 which is less than four and it would do it again and would repeat the process from 2 to 4 times. Now, within the loop, this is gonna be a simple little line. What I want to do here is I want a reference the combo box, just like we did earlier. But I'm gonna reference the employee combo box this time, and I'm gonna add an item just like we did within the call type procedures here. But this time I'm gonna reference the form, get to the combo box employees, and I'm gonna add an item to that. But now what is it that I want to add to this combo box? Well, I want to add the names of the employees where the names of the employees coming from. All right, they're coming from the names of the worksheets. Well, now I'm going to reference the worksheet object. I'm gonna say work sheets and I need a reference a specific worksheet and get its name now , which works she do. I want a reference here. Remember, we're trying to populate the combo box called CBO employees with each of the employees. Remember, I got four of which has moved this window for just a moment. I'm gonna resize it here. I got four employees down here. Patrick and Joe T and Brent and Jo P. Well, if I do this if I say me CBO employees dot at item reference the worksheets object, which is a collection, it holds all the worksheets inside the workbook. I could say Give me number two. Give me work sheets. Number two, give me its name. But then I would Onley ever get Patrick How many times when I get Patrick like, get Patrick, I'm gonna loot 2 to 4 times. I'm gonna loop four times, so I just get Patrick four times. Well, remember I every time the loop runs, I iterated to the next value. It starts out it too, because I want to get the second worksheet, which is Patrick. I don't care about call centre log. I just want the employee names, so I'm just started Worksheet number two. Next time it loops, it's now three. Next time it loops, it's now four and so on. So rather than me hard coding or putting a literal value in here, I'm gonna use the letter I which stores and numeric integer numeric value which changes first time it runs is gonna give me sheet to the next time I loop iterated its its version . It's gonna be three, which gives me Joe T and then four and so on. Well, you know what? I guess I don't want to run four times. I have a total of five worksheets down here. I only want to get four of them though, right? Well, rather than me dynamically or excuse me rather than me putting a hard number in there. I'm once again I'm gonna reference the worksheets objects Never The worksheets, objects, stores, all the worksheets within the workbook and the worksheets Object has a property, dots has a property call counts. I wanted to luv from four to to the total count of worksheets within the workbook. So it's gonna loop from to in this case 12345 times the total count of worksheets in the workbook Let's see what we got. I mean, it tested out. So a simple little loop four next loop just adding items to the combo box and dynamically referencing the worksheets. I'm gonna go ahead and hit play. Here's my nice little call for him. This is a call type that we did earlier. And now here's the employees got each of my employees in there. It's just looping from one to the next to the next to the next Tell gets to the end, the worksheets count, and as it's looping from once in the next, it's getting the name of the worksheet and populating the combo box. So try this out. Get back into your code, get back into the initialize event for the user form and just four little minds for simple little lines here creates a loop to go through each of the worksheets and grab their names . Dry it out. 7. Setting Default Values of Controls on a UserForm: So there's one more piece of code that I want to put into the initialize event for our form . Let's take a look at the form I'm inside the V B a window. I'm gonna go hit the little rotten run or the play button up here at the top. Now, we've already pre populated on initialize of the form, the call type. There they are. And we created a super slick little loop to populate the employees based on the employee sheet names. Now, I also want to give a default value to the call date. As soon as somebody opens a form, they initialize the form I want today's dates the current date to be populated inside the call date control. This is gonna be one small, simple line of code. I'm gonna close my form. I'm gonna double quick my form. This takes me back into the event initialized that I'm gonna put this down towards the bottom. Now I want to put the current date. Whatever the current date is today, tomorrow, whatever. Whenever somebody opens the form the current dates, right? I want to put that into the call date control. So first I'll reference the form me, I'm gonna find the control called txt called eight dot and I'm gonna get into a property called value. So get to the form, the specific control and the value property. Now, I want to make this equal to the current date, and I want to format the current date a specific way. So I'm going to use a built in method here built in function called formats. And this is gonna take two things from a first. It wants to know What do you want? A format? Well, I'm gonna use another built in function here called Date. This is built into the V B. A environment using date here, it'll pull the current date from your operating system. And now I want a format. It's like, uh, see, two digit month slash two digit day slash and four digit year. So I've got my format function formatting the current date as such two digit digit mont two digit day, four digit year. Now let's see what we got. I'll go hit the play button and we've now got a default value for call date. Today happens to be the 23rd of August of 2060. I opened this up tomorrow. Quick initialize the form. And I got the 24th of August 2016 already formatted. Already populated for me anyway, that we can help assist with data entry. It's a win. So try this out. Get into your form, get into the code the initialize event for your form and one little line of code you can pre populate set a default value in this case for the current date and formatted a specific way. So try this out. 8. Adding VBA Code to a Button on a UserForm: so the forms looking pretty good. Let's go ahead and preview. Once again, I'm gonna go click on the little play button. There's my form again. All the controls out there relabel them renamed. I'm got nice little drop downs for both call type employees, and we got a default value for call date. Now let's take our form a step further. I mentioned earlier any time that we can assist with data entry, it's a win now. What do I mean by that? Why is it a win? Well, if we're relying solely on the user of this form to fill out all the details, they're going to do something wrong at some point or multiple, different people filling out this form are going to do things in different ways. So anyway, that we can control it. We can tell how we want things toe happen, the better off we're gonna be. The more consistent within our data entry. So what I'd like to dio is these two buttons here little ass trick buttons that I create earlier, the start time button in the end time button. When somebody clicks these buttons I wanted toe automatically populate the time the current time. As of clicking that button, I'm not gonna rely on the user to go down to their system clock or look at the clock on the ceiling or whatever and plug in the time for me. I'm going to do it for them. So let's close the form. Get back into R V B, a window getting tore user form. Now, I want to put code on my button here. Well, I'm gonna give my little button. That's gonna be the start time, but I'm gonna give it a double click. This will take me into the click event for the C M D start time button that I created. Now, this is gonna be a simple little line of code. Nothing big Remember doing this one earlier getting to the txt called date, getting to the value property and setting up the current date for man in a specific way. We're gonna do the same thing, but instead of date, I want time. So I'm gonna hop back up here. I'm in a reference the form me dot I want to get into the txt start time and I want to change its value dot Value equal to that nice little format function that we have and rather than date, I'm gonna do time another built in function. This time it'll pull the current time back to us, and I want a format that a specific way. Let me. It's a two digit, our two digit minutes and two digits seconds, and that's it. One simple little Lina coats set up a default value when somebody clicks a button toe. Have a populate txt. Start time on our form, with the current time formatted as such, let's try this out. So once again, I'll hit the run button. There's my nice little for So imagine somebody opens us up. They pick up the phone, they open up the form. Then they hit the buttons to capture the current time. There it is. It's in military time, so 1712. 11 seconds It's captured that now they fill up the rest of the form. They finish the call, and I now want them to hit this button that will give them a time stamp for when they finalize the call. So try this out. Get into your form, right, get to your two little buttons. There's too little gastric buttons. Give him a double click. You'll get a click. Events for the button that you clicked on. Set its value. The controls value. Start timer In time, it's value to the current time. Trade this out. Do both buttons there. Get to start time, get the end time, you'll be good to go. 9. Creating a VBA Procedure to Display the UserForm: So we've got the beginnings of a super slick little call centre form or whatever type of form you want to create. Here. We're create a call center for him. But this could be anything. This could be an employee for him. This could be an order entry form. This could be a time sheet. It could be your imagination. Is the limit here? Whatever you want to create. Now, the way that I've been testing this in viewing the form is from the VB a window. I've been hitting the play button. The run button. This allows me to execute the form and now I can interact with the form. Well, you know what? That's great for our testing purposes. But what about the user? I don't want them to have toe get into the V b a window. Worry about all of this stuff here and hit the run button because you knows what can happen . Once the user gets in there, they could even destroy the form. That's not definitely not what I want to happen. You're So what I'd like to do is out here on the spreadsheet itself, the worksheet instead of excel. I want to put a button. Now, when somebody clicks on it, it will then open the form. All right, So before I create the button, I need to create the little bit of code instead of a V B. A module that tells the form to show itself. Toe open up. So take a look. I'm gonna close my form. I'm back inside the V B a window. Now, in order for me to write a sub procedure, that's not code on the form I need to create what's called a module. So in the V B a window I'm gonna go back up to in search. Remember, this is where we found user form earlier. This time I'm gonna create a module, and all the module is it created a new fold over here called Modules and create a model called Module one. A module is where I can place code that's not specific to a form or a specific worksheet or the workbook. This is just code that I could potentially use and reference anywhere within my project. So now inside the module, I'm gonna create a sub procedure, or I'm gonna write a little a little bit of code that I'm gonna package up by giving it a name that I can then use to show the form when I tight to a button. So now, once again, I go back up to insert I'm gonna go to procedure now just f Y I Another name for procedures . Something kind of more front and related to excel. You might call us a macro, but inside of your V b A, we're gonna call it a procedure. We call him specifically here. We're gonna create a sub procedure. So first that I get to give it a name, I'm just gonna call this show call center form, and I'm gonna relieve the rest of the settings that default. We're gonna create a sub procedure, and it's gonna be public and scope. I'll hit. Okay. All right. Show call. Center form. Got my beginning Sub procedure in sub. Now it's gonna be a really simple little line of code. I just want to show the form that I created. So I'm gonna reference my form, which is called FRM call center form. I can see the name of it over here in my my project window, and I'm gonna do dot This gives me access to everything that I could do with this form. And I'm gonna tell it. I want to show the form says simple. Get to the form dot and I'm gonna show it. I'm going to get to the show method. That's it. So now I've got a nice little procedure here that I can now tie to a button. When somebody quits the button, it will run this procedure called show call center form. And all it does is show the form. So I'm gonna close my vb a window, get back into my worksheet here and now I need to create a button Well, where you get buttons from While buttons can come from a couple of different areas within excel for me. I'm going to use the developer tab now just enough. Why I the developer tab is not on by default. So what? You need to dio If you look at your ribbon and you don't see the developer tab, you need to go to the file tab. You need to go down into options. Inside the options window will go to customize ribbon on the customize ribbon tab. You'll go to developer and make sure that that is checked. Once it's checked, you can hit. Okay. You should now have the developer tab on the developer tab. I'm gonna go into the control section, and I'm gonna go to insert, and I'm gonna insert a button. Control the first little guy there. I'll give that a click. I'm gonna come out to my work. She here is gonna left, click and drag to create a button up pops up my assigned macro. And there's my show Call center form. I'll select that. I'm gonna hit. Okay, now, I've got a nice little button there. I want I want to rename this saying we called this. Ah, let's see, Add call log. And if you'd like to you conform at that. You could do whatever you like with it and see if I can get that text there selected. It's always not Not always the easiest thing to do, but there it is. Go home. I'm gonna make it bold. I'll bump up the font size a little here, but I got a nice little button and I'm gonna cook away to de select. And now when I click that button, it launches my form. There it is. Got my nice little interactive buttons in there. Got my drop downs. I've got a nicely conform, and I've got a quick, accessible way to give people access to that form. Right there on the main worksheet. Click the button. You got the form. So try this out again in your VB a window Alz f 11. You're gonna create a module in that module, you'll insert a procedure given a name and one simple little line of code. Just the show. The form. Try this out and create the button. Tie the procedure tied the macro to button.