Updated June 12, 2023
PART- 6 – Visual Basic Editor (VBE) – Debug Toggle
Transcript for Video- Visual Basic Editor (VBE) – Debug Toggle
Video on Visual Basic Editor (VBE) – Debug Toggle : Hello friends welcome back we had earlier looked at play, pause, stop and design mode and understood what are the implication of these, now in this set of video tutorial we are going to look at what this debug things is all about and how we can kind of look forward to debugging various things, debug by nature it means that there are certain elements error and if you may want to kind of remove error or identify error you can use certain tools so these debug here essentially help us in you know identifying error so we will be discussing what is the step into, step over, step out and you know what is watch and how you know what is exactly would be toggle break point etc. so these things we are going to discuss here so lets start so here in this function which was within the sheet 1 A we had this sub routine called sub A and we had earlier written this code with ends up now lets assumed that I just want to kind of introduce some complicity so as to explain this concepts in beat more detail say for example you know I will be introducing variable if you are unable to follow why we are writing this please note that we will be discuss all this in a different video tutorial all together but I am just writing some specific codes and I’ll actually explain you what this means I am writing this Dim X as integer so this is basically syntax which defines X as an integer so this is the way you know you can define integer within a the visual basic editor and likewise I would also like to look at Dim Y as integer ok there are 2 variables which we have defined X and Y both of them as integer ok I am just doing, I am writing some of the aspects of the code lets say X is equal to we had here cell 1 1. Value so whatever is the value of cell 1 1 that will go in this variable as X ok, and let me define X as X + 1000 and cells again that same cells 1 1. Value is equal to X, so what I have done here essentially I have just introduce variable X, which takes initial value as 13000 here, for example, and then X is incremented by 1000, so this new X would be the original X which is 13000 + 1000, i.e., it will become 14000 and then cell 1 1. Value will equal to 14000 so this code 3 step code is essentially nothing but the one liner which we have already written so I’ll remove this one liner for the movement and kind of go ahead and use this code so let me try and see if this works let me play this and look at the left hand side you know it is now incremented by 1000 let me play this again, again 15,000 so this, code looks fine so this was respect to X I would like to have similar code for Y so I’ll just copy this code here CTRL C and paste it and instead of you know having this cells as A1 which was cell 1,1 I’ll have probably I’ll choose this cell which is 2,1 this is row number 2 and column no 1 so this will be 2,1 so I’ll go back to the editor again this variable Y is equal to cells 2, 1 and I’ll tried the same code exactly a same code instead of X variable this will a Y variable now and sales 2,1 is equal to Y so and the probably I would just change this Y to Y + let say you know 2 so what will happen is this will basically incremental counter of 2 this is an incremental counter of 1000 so let me delete this and make it to 0 and now I’ll probably run this macro and see how it functions so the movement I’ll click run you can see that you know the first X variable actually increments this by 1000 and the cell 2,1 increments by 2 let me play it again so this codes looks to be perfect as such let us now move to what we actually wanted to understand this is basically regarding the debug functions so here as you can see this is something called step into here on the left hand side the toggle break point first let us discuss what is the toggle break point is nothing but the place where you want to kind of stop you code to run let me show it for example you know here let say for my cursor here in this line and I click here on the toggle break point now what happens is this gets highlighted in red and this essentially means that whenever I will run the code there code will first run from the top till this line and if I press the run button again then it will run the remaining part of the code so let see how this works so for example I ideally if this the toggle point would not have been there if I remove the toggle point for the time being ideally 5000 should move to 6000 and 10 should move to 12 so let me do that once right so that actually happens in sequence but now I’ll place the toggle point here in this Y and so I’ll press run so what will happen is only the first one or the X variable will move and cell 1 1 will get updated however the 2nd one will not get updated let see how this works so I am clicking here on run and as you can see the 1st one is gets updated and this were it get highlighted in yellow this means that the codes are actually stopped here now I can click here to continue so I can also have this function F5 I’ll click here to continue and as you can see now that variable Y has also been updated so let me do it again run the first variable gets updated I’ll press 2nd button, continue and it second variable is also gets updated so this is how you know you can use this toggle or break point.