Excel Macros and VBA | Thomas Fragale | Skillshare
Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
2 Lessons (1h 3m)
    • 1. Excel Macros Skillshare

      0:58
    • 2. Excel Macros

      62:31
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

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.

122

Students

--

Projects

About This Class

A macro in Excel will allow you to record your repetitious steps in your Excel spreadsheets, so you can automate them. This video will show you how to record, run and manage your macros in Excel. These steps will run in Excel 2007, Excel 2010, Excel 2013, Excel 2016, Excel 2019, Excel for the Mac and Office365. 

Topics Include:

  • How to record a macro
  • Saving a workbook with a macro
  • Different ways to run a macro
  • Editing A macro
  • Using the Personal Macro Workbook
  • Assigning a macro to Form controls
  • Assigning VBA code to form controls

Meet Your Teacher

Teacher Profile Image

Thomas Fragale

Microsoft Certified Trainer - 2152801073

Teacher

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

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.

phone

Transcripts

1. Excel Macros Skillshare: Excel, Macros and VB A presented by time for Galley Microsoft certified trainer. This video will include how to record a macro saving a workbook with a macro, different raised to run a macro, editing a macro, using the personal macro workbook assignment, macron of form controls and assigning VB a code to form controls as well. 2. Excel Macros: As you can see, here's a pretty typical Excel spreadsheet. And you can tell that my screen I am using the newest version of Excel as of the recording . Now, if you notice, um, let me show you the old school way of giving in tow a macro. You're picking the view menu, and then over here, you would pick on macros and the right and then you can do the view. Macro zor record Macro from there, however, I'm gonna give you a way that will give you a lot more futures with him. Macro, we want to open up a different toolbar that's called the Developer toolbar, By the way. Sometimes during this session, I'll make my mouse do that so you can find a mass that way as well. So if the developer toolbar were on, it will be to the right of the view menu. So let's go ahead and turn the developer toe toolbar on. We'll pick in the file menu and then under file will pick on options. The options, of course, give you many ways to customize your version of their cell on your computer. I'm gonna pick where says customized ribbon. Now remember, the ribbon is a new word for the toolbar. And then ever here I make sure the red developer is checked. So we picked on file and then options. Then I picked the word customized ribbon on the left. Then I made sure they were developer is checked on the right hand side when I click on. OK, now we see the developer toolbar. That's going to give us a lot more choices with our Makris, which will discuss So the first macro that we're gonna do today is going to be the automated advanced filter. Now, I want you to know that the macro is is not just about the advanced filter where he used a macro to automate anything. I'm just used this as our first example. So I'll pick on a sheet to here. Now we see the criteria for the advanced filter. So no matter what the macro does, they always get started the same way which is coming up right now. So we'll pick on the developer Minya. And over here, I pick on record macro, and then we'll get this screen. Now you want to give you a macro and name, but the name doesn't like spaces for whatever reason. So I'll type in a run filter with no spaces. Now you can use an underscore in the name if you want a toe. But the name just doesn't next basis. So typically I'll give the macro a keyboard shortcut to make it easier to run. You can use upper case letters or you can use lower case letters. So I'll type in. Uppercase are knows to run that macro, you would use control shift our we can also use lower case letters. So in this case, I'll take the lower case R and now to run that mackerel we would use control are so you can use upper case letters or you can use lower case letters. I have tried numbers. It just doesn't allow that. So you want to use upper case letters or lower case letters? Why is that important for you? Well, as long as this workbook is open control are is now going to run the macro instead. What? It usually guys, it's gonna override what it usually does when this workbook is open. So you wouldn't use control. Sit right, Because that does your copier. You wouldn't use control V because that does your pace, so you would think a lot of that you don't use for something something else. I can't think of anything you just control are for now. Here's why. It's also important if you store the macro in this workbook, which is the current workbook. It will only be available when this workbook is open. However, if you store into the personal macro workbook that actually opens up in the background every time you go to excel, so it'll be always available. So it becomes, ah, universal type of macro that's always available. So if you think, think of something that you want Oh, all the time, then perhaps you put it into the personal macro work. Let's put this one into this workbook. Now you can type in anything in the description, or you can leave that blank. That's really optional, and that's for documentation purposes only. More importantly, I would give it a good name, recalled that run the felt tarp and there's no no space is allowed in the name, although you could use underscores if you want a toe for the shortcut key. I gave a control are and we're going to store it in this workbook and you can type in anything in the description. Or you could leave that blank all Mac rose no matter what they actually dio they could start it that way. So I'm gonna click on, OK, we're now recording our macro. Here's how you can tell there's a little square down here at the bottom. Now you want to leave that swear there. Now, every step that you dio within your Excel spreadsheet is gonna be recorded as all interested that square. When we're done recording, then we'll click in the square. So now you would do any steps that you want to dough. Maybe it's copy and paste or format or print or as many steps as she went to death. In this case, we're going to the advanced filter. Now when I run the events filter this time I want a countess steps so we'll see how many steps is going to save us at the end. So I'm gonna click in the sheet that's called Europe Expenses. I'm gonna call That's step one and I'm going to click on Cell a one. A call that step to now the advanced filter is on the data menu, so picking their data up top, that'll be Step three. I'm picking the word advanced, which means advanced filter. And I see it when it says advanced filter that was stepped for. The only thing I have to change in this window is the criteria range. So I'm gonna click in this page for the criteria range that was stepped five. Now, in this case, the criteria is on sheet to so pick on sheet to at the bottom. It was step six. I'm gonna highlight the criteria a one f five and then just as ah, side note with the advanced filter, when you're gonna highlight the criteria, you just want to highlight the field names and then go down as many rose toe have the information. You don't want to include any blank rows or any blank homes. That's why I went from a one. The F five that was very Step seven knows how that filled it in here in this window when I click on OK is going to run the advanced filter with that criteria, as you can say. And that was Step it. I'm still recording my macro here so you can tell there's little square at the bottom right over here so I could doom. Or after that, maybe next is copy and paste or print or as many steps if she went to dough. When you're done recording your macro now we'll click in that square. So I'm gonna movement asked to that square and look what it says. A macro is currently recording particular to stop recording, so I'm going to click on that. We just recorded our macro. Let's see what that really means. I'm gonna get back to sheet to again and I'm gonna change the criteria. So it said the word Italy, I'll type in Spain instead of France. I'll type in Austria, and I'll come over here on the same row of United States. I'll type in hotel. Now I have different criteria. I want to rerun the macro. I want to rerun the advanced filter with the new criteria, and that's exactly what the macro does. So remember how I said the keyboard shortcuts should be control are and before I can eight steps so their control are on my keyboard. Now that's just rebrand the macro that we ran the events filter, except I reduced it down toe one step. That's the entire point behind a macro. We just went from eight steps than the one step. Well, if that was 30 steps, what if that was 90? If you get this right, you can save so much time because we just automated that whole routine. Let's try to get we're *** she to I changed the criteria again. So here I'll type in dinner and then hotel and then taxi. All right, so I have different criteria again. I want to rerun my advanced filter and I'll use control. Our control are will run the macro, which will run the advanced filter except that reduced the dental one step. So remember, the macro is not just about the advanced filter that's made the example that I'm using right now, the macro can be used to automate just about anything in your excel workbook. Now, let's make sure that we save this spreadsheet the proper way when a Excel workbook has a macro has to be saved a certain way. Otherwise you will lose your macro. So I'm gonna come up here and pick on safe. Now, look what it says. The following features cannot be saved in macro free workbooks. The VB project, which is the macro to save a file with these futures. Click. No. So the correct answer on this window is No. I'm going to move on now. Now we'll pick on browse over here, and then you have your classic city vast window. Here's the really important stop. I'm gonna click where it says Excel workbook. And then you want to save it as a macro enabled workbook, or you will lose your macro, plain and simple. You have to save as a macro enabled workbook, or you will lose your macro, plain and simple. Eso knows how has a different file with a different file extension? The normal file extension for Excel is X l s X. The file extension for a macro is X l s m m for macro. Okay, so that's really important. I'm gonna click on save and now that was the proper way to save the macro. Now let's go ahead and see a few ways to run that macro. So I'm gonna go back to excel now. Good. By the way, the filter is still on right now. Well, the filter is always temporary, so let's get the records back from the filter. I pick in the data menu in a pickle. Unclear. And now the records were back from the filter. So even though we ran the filter with the macro, the filter is still the filter itself is temporary. We could just get the records back. If I ran that macro again, then the events shelter would run again. Okay, so now, in this case, I'm gonna pick on the developer menu. I'm gonna come over here and pick in the word macros. Now, see, the wants to say personal those air in my personal workbook, and I could show you what that's about in a few minutes, but the one that we may just now is called Run filter. So you would see all of the available macros and the workbook certainly could have more than one happens all the time. That's what you want to give them a good name if they're all called macro one and macro to get really confusing very quickly. So you want to give those a good name Now? One way to run that macro is to use the keyboard shortcut like we demonstrated. By the way, if I pick in the word run filter here, if I pick on options, then I could see the keyboard shortcut or the description. Or you can change those items at that time as well. All right, So you gonna view or change the description or the keyboard shortcut when we picked on options. Now, even here, I can pick on run filter and then Pippen the word run, and that would run the f macro. Let's see some other ways to run them. Akra. I'm gonna get the sheet to now. So imagine right about here. You had a button that if you click on that button, that would run the macro. Let's see how we're gonna do that. This makes especially even more automatic for the other person. So once again, I'm gonna go back to our developer toolbar, and I'm gonna pick in there would insert right on the toolbar. And these air called controls the controls. Make your spreadsheet easier to work with for you or for other people. Now there's form controls and there's active X controls. All the form controls can be set up to run a macro. All right, so I'm going to use one of those right now, the Activex controls knows how. There's a lot of similar choices. The Activex controls. Can you could type the V b a code directly into those. And I'll show you what the V B A could is just a second. So the form controls can all be set up to run an existing macro. Where's the Activex controls Can you can actually type in the V b a code directly with the shading? Simple of that pretty soon as well. So I'm gonna go back to this one. It says it's a button. All right, so we're gonna click there now. I move my master over here and then click there When I click that second time, it wants to assign a macro to that button. So I'm gonna click on run filter. So it's blue like that, and we'll click on OK, so the well, let's see what's gonna happen. I'm gonna click on. OK, so that button is gonna run that macro. Well, of course you want that to say something different than just button, right? So I'm gonna right click there and then we'll say Edit text. Let me show you something. If you right click on that. If you hold down your right now spotting too long you get this weird menu. That's not the right one. If you get there were men you it means you held in your right mass button too long. Just right. Click it really quickly. Then you get the name and you like that. So I pick on edit text and then will change that to say, Run Felt her Now it's OK. Tohave Ah, space on that one. The only place it wasn't allowed to have a space was that name of the macro. But here you can have a space and I make that bigger with the sizing handle. Good. So I can right click on that button. I can change the text. I can actually assign it to a different background. So let's see how the button runs if you just click on the button. At first I clicked away from it. Then I click on the button and that will run the macro. Okay, Snow. That makes him more automatic for the user. When we do it, something like that, So what we did was we picked on the developer Minya, that I said insert. This is called a a button. We're gonna click that, move it over here somewhere. And then when you click the second time you picked a macro that you want to run with that button, as you can say, then I was able to right click on that, and then we can edit the text or assign the macro. In this case, I'm just gonna cut that one since we already have this one every year. Now the button you can see when I move a mask, that button the mass becomes the pointer, which means it's an active button. If I click on that, that ever does run the macro. Now let me show. I really can't format that too much. So I'm gonna right click on it, actually, right Click And then you could see how it select it. It does say format control, but I can change like the fine. But there's nothing really about the color of the button or anything like that. It's just about like the text. So, um, even if I pick on the format menu a lot of these things were great out. So let me show you where you can have more flexibility. What you'll do is maybe make a shape. So picking the insert Minya Now, in this case, I'm gonna expand the word illustrations. But a lot of times, the words shape is on the insert menu. Here have been illustrations in the pecan shapes. You can really choose any one of these, and then any one of these can run a macro. So, for example, used the oval This time I'll click over here. Now I'm gonna type and run filter there and that all apply the text to that to that shape. Even here, you know, obviously we conform at the text. In many ways, that's fine. But with this one, if I pick in the format menu, then those choices are available so I can change the colors and every every other thing about that shape. You have a lot more flexibility with this one. Now, what does this have to do with Makris? Well, I'm gonna right click on that shape. Right click. She does that were menu again, just right. Click it really quickly to get rid of that and I'm looking for a sign macro. And then that would be used to run the macro. But that one has a lot more flexibility than than that control. But knows how. If I move my mouse there, that runs the macro good. Actually, you can do that with just about anything in excel. This time we're gonna assign it to a picture. So say insert. And then that one, we just It was called a shape, but let's go ahead. And we could even use ah, picture from your computer or an online picture so we'll even go with an online picture. In this case, I'll type in the word filter, see what it comes up with. Well, that's fine. So I'll use Thea. I use that picture right there. Click on insert. Okay, now made it really Rory bag. A lot of the pictures will coming really back. So we're gonna resize that down to a normal size and that's fine. Eso now here it came with a credit for the picture, which is fine. I'm gonna go ahead and right click on that, and even that can be assigned a macro. And now that picture is alive active picture. If I click on that, that'll run the macro, as you can say so. Really, even if we had a chart, I can right click in the chart and you'll see a choice that would say a sign, a sign maker to that So I can assign a macro to one of those controls. We can assign the macro to one of those shapes you can assign a macro to, ah, picture like that and then even like a chart. If you right click on the chart, you be able to, ah, sign the macro to that in many ways. Teoh surrender macro. In this case, I don't really need that picture. Eso I'm gonna click in the picture and then press my delete k good. In fact, we have this extra tax every year, and I'll delete that good. So let's go back to our power point slides and we'll see four ways to run a macro. The keyboard shortcut. Uh, I should a command button a graphic, and then we could even add it to the quick access toolbar. So this slide is going to show you how to add it to the quick access toolbar So let's do that. We'll go back to excel. The quick access to a wire is up here, so watch how I'm gonna make a so a Nikon and the quick access Tobar can run a macro. I'm gonna go ahead and click on the icon. The little arrow to the right of the quick access to a bar will pick on Mawr commands. Now, this is the way to add things to quick access toolbar in general. So, for example, I can pick on copy and then pick on ad. And then it's on the right hand side, which means is on the quick access to a bar or pick on cut and pick on ad. And now it's on the right hand side, which means is on the quick access toolbar. So let me show you what this has to do with Makris. When I click on this, pull them. Where is his popular commands? And then we see Macron's that so you find your macro or this and then we'll pick on ad and it's on the right hand side now with that, when I can change the Ike, I'm so I'm not really crazy about that icon. So I'm gonna come down here and picking the word modify, and then you have many icons to choose from. Like there's Ah, filter right there. Good. And actually, let me go back in to modify again. We can choose a different icon, but you see where it says display name. That would be the text that they would see if they put their mouths across that icon. Now this we're gonna have a space as well. I just want to give that better text. Can you get a text this down? And we should a new icon we're gonna click on OK, and those how that like, here's the copy and the cut icon, but then knows how I could move my mouse to that one. It says Run, filter, And that will run the macro. Okay, so now I gave you a new way to run a macro as well. They make it even more automatic for the other person or even for you. Eso Let's go back to that slide now and we see how I'm going into, um, you can pick on file and then options, of course, to get to this window and then we picked on the quick access told by I clicked on the pull downwards, his popular commands, and we picked on Mac Rose. Then at that point, we would pick on the macro the macro name pecan ad, but make it on the right hand side. And then at that point, you're picking their modify over here, and then you pick among your icons good. And then, you know, in this case, he used to funnel as well. Now this slide is showing us how we do turn on the developer toolbar, which we already did. So again, I would pick on file and then options and the picked on customize than customize ribbon and then make sure there were developer is checked and that'll turn on your developer toolbar. Good. And then this is where we actually added the the button. And so I picked him developer and then insert. And we used this first whenever here, which is called the button. And then we assigned a macro to that button. And there's that. But then I would right click on the button and then pick on edit text. And then here there's that button that you could see I out of the picture onto here, and that picture can be right collect. And then you would say I'm a sign maker from there as well. So it gives you multiple ways to run your Makris of the other way to run the macro would be to go toe to the developer menu and think of the word macros and then you're picking the macro name and then pick on the word run, and that would run the macro as well. But usually I'll give that a keyboard shortcut, or I'll give that, you know, one of the other methods to run the macro. Now, this slide is showing us the V b A code. So why don't we take a look at what the mackerel looks like? And I'm gonna go back to excel. Of course I will go back to this. A cell spreadsheet. Now, in this case, I'm gonna pick on the developer Minya, and I'll pick on the word macros and we see a list of hackers. So up in the world, run felt her. And then you come over here now you could delete the macro if you wanted Teoh so that you can re record it. Sometimes the more complicated ones take a few times before you get it right, so you could delete it, and then we record it. But in this case, I'm gonna pick on edit. Okay, this is Ah, this is the V B. A code, the mission and why it's called VB A. If you look at the top of this window, it says visual basic for applications v b A. So it's a full programming language. Eso I could show you some examples of this programming language in the session. You could find a lot more on Google on different resources. I mean, you might have to take a whole semester on the V B A to get really good on that or even more than one semester, quite frankly. So, you know, you probably have to take a different course or do some more research on the Internet to get really good at this language. It's a full programming language. This is the code that got recorded when we made the macro. This is the code that runs when we run the macro Now. Sometimes it could be dozens, if not hundreds of lives. This was not so terrible. We did a couple of steps within our macro, so let's go through what we're looking at. The word sub means maybe sub program or or sub for team, and that's the beginning of the macro, and we considered mean that we gave it right in the filter. Do you see the lines of there in green? Those air comments those air for documentation purposes. So to make a comment in your code, you can put an apostrophe at the beginning of that line, and then the whole line becomes a comment. Or here's another thing you can dio at the end of this line of type in a space type, a single quote or an apostrophe there, and I'll say this goes to the Europe expenses. She let's see what happens when I leave that line. See how that the rest of that line is in green as well, so I can start the line with the apostrophe and then typing the comment there or, at the end of, ah, line of code, our type of the space, and then type in the apostrophe there. And then that would comment that one line. So either way, is perfectly fine. You could have as many of those as you need eso. You can see how this line Issa's sheets, Europe expenses that select so that really goes does go back to that sheet. Remember the next thing I did within the macro? I went back to sell a one. So here says, Range a one select, so that's going to go back to sell anyone. Now I know for a fact that these three lines don't really do anything. I can actually delete those lines, and nothing will happen to the code so I can actually delete those lines. Not a big deal. This line says something about the advanced filter, so I guess that's where the Kurd runs D Advanced Filter. Now, if you look to the right of that line, it has an underscore. The underscore means it's going to continue on to the next line. So the line this has sheets and she too. That's a continuation of the events filter line. I can tell because of that underscore right there and then we see end sub, and that's part of the structure. There is a sub appear that was the beginning, and then n sub is gonna end the macro. So this is a code that goes along with the macro. This is the V B A. Could anybody can record a macron? Aka should you? At the beginning, you would go in here only when you want to make the macro do something different or if you want to, you know, change it or fix it. Sometimes all you have to do is record the macro, and if it runs, then you're set. You would only have to go into this screen if you want to make it do something different or change it or affects it. You know that kind of thing on. Then I can show you some examples of the V B A could in this session and you know you call . You certainly have to do more research on the Internet or take a course just on that to get really good on that language. Let's make some changes to this code, so I wanted to ask to user are the shore if they want to run the filter or not, and then, based on their answer, will either run the filter or or not. So let's try something like that. Now I'm gonna come over here after that green line and I'll hit the anarchy a couple times to add somewhere black lines. Now I want to set up a field that's called Answer to be used within the program. So what you do is you damn it. Any time you want to set up your own field, you have to dim it. Now, in larger programs, you'll see multiple dim statements, each one setting up a ah field. So now I can use a fear that's called Answer in the program, because I just didn't I think den means declare in memory. But I know that anytime if I want to use a few other have toe dim it like that. So I want to ask the user a question. The way I could do that. It was something that's called a message box. So it's been Answer Wells Message box. I spelled M S G B O X, and it will show a message on the screen. So this point I'll do an open parentheses. It's gonna work like a lot like an excel function. See how type in an open parentheses and it will give me the syntax of that function. So a programmer would be happy to see that syntax. It's useful. The prompt has to be in quotes, so dio open quotes. Now you can type in anything between the quits. So I say, Are you sure you want to run the filter? I'm asking the other person. Are you sure you want to run the filter? And then I have a close quits at the end. Well, just like in Excel function, the parts of the function will be separated with a comma. So it's happened. A comma. Now the message box comes with buttons. So is trying to ask me what kind of buttons I want. So I'll scroll down and I'll double click where it says V B s. Now that means it's gonna be a yes button and a no button on the message box. And I closed the Prentice's. So that line says answer equals message box open parentheses, open quotes. Are you sure you want to run the filter? Close quotes, comma VB? Yes, no close parentheses. So that's gonna ask that question to the other person. They can, um, they can answer either yes or now, and whatever they pick will go into a field that's called Answer. So that's what that line is going to dio. Now I want to evaluate whether they picked yes or not. So this is where you might use an if statement. Probably the most probably the most popular statement in all of programming is the if statement. So also have been def and sir equals now the either type and yes or no to that question. The visual basic equipment for the world. Yes. Is the word VB? Yes. Tipping db? Yes. Now the if any time the line starts within, if it always ends with the word then that's quoted if then So we're going to say if answer equals V B yes, then that means they picked us to that question. If they picked us to that question, then I want to run the advanced filter, which is there from before, however, if they picked no to that question, I want something else toe happen. So we're gonna add some new statements here. I'm gonna click right before the e of the end sub press the enter key a couple of times, we go up a little bit and type in the word else. The else is the false part of the F. So if the if is true, then everything between the word if and there were else is going to run. But the if is false, then everything after the word else is gonna run. So the else is the false part of the F. Now, if they picked no to that question, I don't want anything to happen, but I want to tell them that nothing happened to make him feel better. Okay, so I'll take the message box I protected and before message box open parentheses, open quotes and I'll say, OK, nothing happened. Tell them that nothing happened to make him feel better. Close quotes, close parenthesis. So that line says message box open parentheses, open quotes. Okay, nothing happened. Close quotes, close parentheses. Now, any time there's an if, then somewhere below, that has to say end if and that's in in that structure, which is really important. So we'll see what this code that was in just a second. Well, I highly recommend it. Everybody is record the macro Levitt. Do as much as I can for you and then you go into into the screen to make your changes. But usually I would record the macro, and that could be a great head start. That you could make her changes is necessary. There's just one small example of making the change to the code. Now here's what I would do with this. Could you see how these lines between the if and the else are in Dennett? You don't have to do that, but it just makes it easier to read. And it's kind of the industry standard. It's what people expect to say. Well, also in that the line between the else and the end F So look, I'm gonna clip E for the M of the message box and then just that my tab key and that all in dent that it doesn't change what the code does. It just makes it easier to read. And it's the industry standard is what kind of what people expect to say. OK, so that could be useful for you. All right, we're gonna close this window now. Now that close this window the proper way, I'm gonna go all the way to the top and all the way to the right and we'll get their red X c were masses all the way at the top and over with the right. You want to close that top window now we're back in Excel again. Well, that was a lot of work. So let's go ahead and save that now. One should make the macro into a macro enabled workbook. It'll be like that from that point forward. So, you know, this did save it to the macro enabled workbook. Now, I have multiple ways to run my macro. So let's say we changed the criteria again. Good. Now, in this case, I could use our original button, so I'm gonna click on the button, which will run the macro. Now, this is a message box. Are you sure you want to run the filter? Let me pick on No, this time. And then there is the second but message box. Okay? Nothing happened, Rights. And nothing really did happen that time, As you can say, this time I'll pick in the button which will run the macro. There's the message box. This time I pick on Yes, and now it does run The vest felt her. So what I have. I recommend everybody is record the macro. Then if it works, it works. But if you want to change it, then you go into the code taken, develop our Mac Rose the picture macro name. And then, in this case, I picked on edit. And then you make your changes from there. So a couple things we added onto this could dim means you're going to set up a field in this case, the fields called Answer. By the way, you can call your fields. Anything doesn't have to be called answer. Then I made a message box. So I said, Answer equals message box and we have the question knows how. When we did run, the curd had the yes button and the no buttons that's with Phoebe Snow means, and whatever they picked on that message will be stored into the fear that's called answer . Then we're going to evaluate what they choose. So we have If answer equals VB. Yes, is is a kind of a bill inward in visual basic that means to pick. Yes. Then we ran the events filter. If they picked no, then the elf cause will kick in, and this way I have the message box and then for the F at the end of the F, we have an end F and that's our enhanced that particular code. Let's try something different Another example with the, uh, input box. So an input box is gonna accept actual input for the user. So in this case, let's say if they run the advanced filter, I'm gonna click at the end of the world, False there, and I'll hit the enter key. Actually, I'll set up another field. So after dim answer would have been comma answer to now, I could have had a separate, dim statement that would have said dim answer to or you can do it this way. I could just separate the fields with a comma. And now that one statement will define answer as a field and also answer to So then down here before the else will say answer to equals. We're going to use something that's called an input box and input boxes where they can actually type in type. In an answer, the message box. You know, they can click on yes or no or one of those buttons with the input box that can actually type in something. So I have input box, open parentheses, open quotes and I'll say, What text? Do you know What? And so which one? So I'm just asking that question and we'll close that parentheses. So that line says answer two equals input box, open parentheses, open quotes. What text? You went and sell each one close printed, close quotes, close parentheses. Now, watch how I'm actually gonna put that result in so each one. So if you look up here this I can refer to one cell that exact same syntax. So it had been range open parentheses, open quotes. I'll type in each one. Close quote, close parentheses. The syntax is very specific here. I doubt value that value equals whatever they tight then for answer to. So I'm actually telling the code to assign a answer to To sell each one. So this is just another example of ah, of the visual basic hood. Let's go in and close the coating window up here at the very top. That and I'm gonna go ahead and run the filter again. This is the original message box. Are you sure you want to run the filter. All pick on yes, there. Now it did run the advanced filter and look what it says Now I want to show you before I type anything in there. There's nothing in so each one at this time, as we can say What text you went and sell h one. Um, this is how the macro IHS So you know I'm typing and whatever text that I want, I'm clicking OK and knows how. So Each one got populated with that cell. So you know those air a couple of good examples of changing the V B A code. Let's take a look at that one more time with the developer Mac, Rose, Run, filter or pick at it. We had the original. If no, that's what I did with the Dem I said Dim answer, comma answer to so that I'll set up a field that's called Answer and they will set up a field that's club answer to then Look what I did Then here I said, answer two equals input box open Prentice's open quotes. Then we had the question close, close, close parentheses, and then this is how I signed that to that cell range h want range open parentheses, open quotes, each one close, close, close parentheses that value equals answer to. So that little piece of code right there has some good items in there, Has a dim has the message box. This whole line is called assignment statement because I'm assigning something to the few of answer that we have. The if statement, this line goes Teoh the Europe expenses sheet. This line goes to sell a one. This line actually does the advanced filter. And then this line is another assignment statement, but it actually runs the input box was asked that question and then this is another assignment statement that assigns whate