 Welcome back to another video. So this video is basically going to just round off the change events that we've been looking at in previous videos. So if you remember, if you haven't seen them already, we looked at how to execute a macro every time a workbook is open. So this is obviously happening automatically. How to also execute a macro when a workbook is being saved. So as you hit the save button, this macro will obviously initiate straight away. And we also further the saving method into going into the ability to create a changelog. So every time someone saves that workbook, we noted down their username and obviously the data which they were saving the file. As I say to build out a changelog. So you, the admin or the owner of the workbook can see everyone who is saving and making changes to that workbook. I just wanted to round that series off by looking at another change event that is closed. So that way, we looked at then obviously how to run a macro when the workbook is open, when the workbook is saved, and then obviously when the workbook is closed. So kind of like the life cycle of someone who's going to be actually operating or working with a spreadsheet. So I must admit this is one I probably don't use as much as you'll see as we go through this example. This kind of gets covered off by looking at the sort of the save option. But there are some good uses for it as well. And as I said that really I kind of just then went back on myself and thought actually a good reason of why you'd want to use this maybe then just the save option. So when it comes to using the closed workbook change event, as with the other ones, we just need to make sure we're in this workbook within our file. And obviously we're in the BBA window here where we can type in our code. So it's going to look exactly, well not exactly the same, but very much the same. So we've got private, sub, workbook, under school, before close. And then in brackets we're going to do cancel. So we'll cancel quickly as they go close brackets hit enter. And you can see it's done the formatting for us. So simply all I'm going to do here is we'll actually leave it as it is for the time being. So I'm just going to save the file and you can see the file is saved. So when I go to close this file because no changes have happened since I've hit save just then. I'll close the file and you can see the file just closes and nothing happens. If you go back into our change event here and all the change event files are in and go into our macro just doing F11. This time if I was to put this change the value of cell A1. So let's go sheets. Let's get rid of the capital sheets. Sheet1.rangeA1.value equals now. So it's going to literally just put the date or the current date and time actually into cell A1. This time I'm going to save the file. But if I was to close the file what you'll see what happened is I close the file. You'll then add the date into cell A1 and because then obviously a change has happened it will now ask me if I want to save obviously the changes that have happened. So I'll also go yes and it will save the file for me. So what we could do is we could take this one bit further rather than obviously having something happen i.e. putting a value into a cell and then being asked to save. We could just do another line underneath this code and literally just put active workbook.save. So now this time when we go to do the workbook obviously I'll just save this again. As we close the workbook obviously you'll see it published our cell value and it automatically saved the file for us. So we actually weren't asked or instructed as to whether we need to save the file because obviously we closed the file. The macro is executed within that macro. It's obviously going to save the workbook as well and therefore it will then allow itself to then close the file having accepted those changes you've just put in. So what does that mean? So this is the real benefit of using this change event on closing the workbook. If you're trying to get something recorded every time a user goes in or you want to just identify who the last person was to go in this will give you the ability to do so. You could also, by using the previous video we looked at creating the save log, you could create a closing log. And the reason you might want to capture that information is obviously there's a number of times when people access a file and even though they go into the file they might not save that file. So they could go in, read the contents and then close it without making any changes. The benefit of obviously being able to capture each person who opens the file and obviously by storing this information when the file is closed is it allows you to see who is actually looking at that file. So you might have this file intended for just two people to look at it. But if you notice that a third name, I don't know, say Tim, is also seeing your data but you don't actually want Tim to be seeing the data. You actually have a change log to show that Tim has been accessing the file. So a bit of a long-winded example there or trying to legitimize why you'd want to use this but that just gives you a potential solution or not solution but a reason why this before closed change event would be beneficial to you if I could even say that word. So I hope you enjoyed that video. As I said it's kind of not too in detail. I don't think there's any point where you're going in much more detail than this. You know obviously from the flexibility we looked in the previous examples of change events you can add any code in here that you so wish depending on whatever you're trying to achieve with this change event. I just wanted to include this one as I say just so you have the full picture of being able to do the macro upon opening, saving and also now closing that workbook. If you did enjoy this video and obviously it would be much appreciated by myself please don't forget to hit that like button. Obviously it's greatly appreciated by myself. And it also helps our all-important YouTube algorithm to make sure that more people will find the video. And if you haven't already or if it's your first time coming across the channel don't forget to subscribe to the channel and hit that bell notification button that way you'll be notified of all of our future videos as they come out. So thank you very much for watching and we'll see you in the next video.