![]() ![]() ![]() To single step through this macro we can either go into the VBE, switch to the module containing the macro and then click on the 'Single Step' button from the Debug toolbar or the Debug menu, or else select Tool/Macro to open the macro dialog and then select the 'Step Into' command button. Selection.AutoFill Destination:=Range("A1:A7"), Type:=xlFillDefault As an example let's turn to our first macro: Alternatively for smaller, less complex macros, it may be that single stepping through each line of code might be a better start. If it is clear where the macro is failing then it makes sense to home in on that part of the code. The Visual Basic editing environment supports a good degree of debugging, which should help to track down the error.įaced with a macro that isn't working there are various places to start in tracking down the root of the problem. Either it will be a macro you have written yourself or else it may be a macro that a user has knocked up and which no longer functions the way it used to. Sooner or later you will find that you have a macro that doesn't quite work. In Excel 2007 it's still Alt-F11, but you can also get to it via the Developer Ribbon tab (if you don't see this then click on the Office button, then Excel Options > Popular and tick the check box for Show Developer tab in Ribbon). ![]() Alternatively in Excel 2000 you can use the Tools > Macro > Visual Basic Editor menu option. This opens the VB environment, with a Project tree on the left-hand side showing open workbooks and modules, and the VB Editor on the right hand side. To get to the VB enviroment the simplest option is to press Alt-F11 from within Excel. For those who want a more general introduction to programming Excel with Visual Basic for Applications (VBA), then our Introduction to Excel VBA is the place to start. The examples in this article have been tested with Excel 2000 and Excel 2007. For those who've never delved too deeply, this article gives a quick run down of the main features of the VBE and shows how it can be used to debug macros and VBA code. While Excel 2007 has seen a monumental change, look under the covers and you'll find the same old VBE that has been there since Excel 97. If there's one part of the Excel environment that has remained fairly stable over the years it's the Visual Basic Editor (VBE) and associated development environment. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |