560 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owls only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Debugging macros in Excel Visual Basic / VBA Part two of a five-part series of blogs |
---|
This series of blogs is intended to provide online training in how to debug in Visual Basic for Applications, including using breakpoints and the immediate window.
This blog is part of our Excel VBA tutorial. You can also learn to program in Visual Basic for Applications on one of our scheduled or tailored VBA training courses.
|
You can use various combinations of the F8 key to step through code, and also use the yellow arrow and right mouse button to change the next executable statement.
To learn much more about programming and debugging in VBA, book onto one of our classroom or online VBA courses.
As mentioned, you can use the F8 key to step through code, but what happens when you reach a call to another routine?
In the example shown, the CheckAnagrams macro is about to call the GetWords macro. What will happen next depends on which function key you press:
If you step into the GetWords routine as above by pressing F8 and then realise that you didn't mean to do this, you can press - wait for it - SHIFT + CTRL + F8 to execute the rest of the GetWords routine and return the current line to the main CheckAnagrams program.
The above keys are great for stepping forward through a macro line by line, but whoever said you had to do this? What happens if you want to go backwards, or jump forwards? The easiest way to do this is to click and drag on the yellow arrow:
Want to run the GetWords routine again? Just drag the yellow arrow to the line which you want to execute next, and Excel will make this the next executable statement.
It hardly needs saying, but you should do this with care only!
Another way to achieve the same effect (though not nearly as much fun) is to right-click on the line which you want to execute next:
Right-click on any executable line to make this the next statement to be executed (it will go yellow).
Once you've got the hang of stepping through macros, it's time to set some breakpoints.
Parts of this blog |
---|
|
Some other pages relevant to the above blogs include:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2023. All Rights Reserved.