Hey guys, welcome back. So in this video, we're going to discuss the difference between recording macros in absolute mode and recording them in relative mode. So the best way to illustrate the difference is to illustrate it with an example. So basically here, I'm gonna start recording a new macro. So I'm gonna go to the developer tab here, click on record macro, and the first macro is going to be in absolute mode. So I'm just going to write its name, it's going to be absolute macro, and then I'm going to click OK.
So now I'm going to select cell A one and put a one in it and then put two in sell a two and then three in sell a three. And then I'm going to stop recording. So now if we examine the code on the macro here, so as you can see here, the code says go to sell a one, put one go to sell a two puts to go to sell a three, put three, and then it's selected a four because when you press Enter, we'd go to the cell that is below the current cell. So if we just delete the one, two and three here in cells, a one, a two and three, and try to run the macro again, you can see here that we got one, two and three, put in cells, a one, a two and a three, every single time we run the macro, we will just get the same result.
Okay, now let's try to record the macro in relative mode. So why the previous macro was in absolute mode was because we did not click on this button here that says use relative references. So let's see when we record it in relative mode, so I'm going to click on record macro here, and I'm going to name it relative macro here, and I'm going to click OK. I'm going to use relative references. Here, put one in cell D for two, and then three, and then stop recording and let's examine the code again. So, as you can see here, it says, put one in the current cell that is active, and then go one cell downwards, put two, and then go one cell downwards and put a three.
So this is what the relative code says. And this means that it's actually going to put one, two and three, depending on which cell is selected. It is relative, so it's going to be relative to the selected cell. So if I select for example, cell f4, and run the relative macro, it's going to put one two and three in f4, f5, and f6. If I select another cell here, J four, render the relative macro we get one two and three, and j four j, five j six, so it's relative to the current selected cell. It's not absolute.
What do we use the absolute macro each and every time we run it, as you can see, I'm going to run the absolute macro. So each and every time it's run, it puts one, two and three In cells, a one a two a three each time it puts one, two and three in the same location, but the second one here is relative, so it's relative to the selected cell. So that is the difference between recording in absolute mode and recording in relative mode. So how do you know whether you're in absolute mode or in relative mode, it's through this button. This button is shaded use relative references. If it is shaded like now then you are in relative mode.
If you press on it again and remove this shade, you can see here you're back to absolute mode when recording. Okay, so that is the difference between the absolute mode and relative mode when recording macros. And I still want you not to worry if you don't understand the code for now. You will be able to understand it as we progress through the course. So thank you very much for watching this video and I'll see you on the next one.