Excel Visual Basic Variables, Part 2: Declaring and Naming Variables, Scope and Lifetime
Subscribe to continue reading
Subscribe to get access to the rest of this post and other subscriber-only content.
Subscribe to get access to the rest of this post and other subscriber-only content.
It is difficult to make your program foolproof, because fools are so ingenious! Even so, one should make an effort to trap and handle errors. You should not let the program simply crash if there is a problem, whether due to bad data, faulty calculation, or whatever. This is what we call Error-Handling. Excel Visual…
The Excel Visual Basic Editor can be set to appear in a variety of ways. In the appearance shown below (the default) the majority of windows appear docked at one edge of the screen. Code windows can be tiled together on the screen, or one can be maximized. The main features of the screen are…
In our previous post, we looked at the steps to record and run a macro. Practice makes perfect, or at least helps us improve, so let’s do an exercise. We will record a simple macro to format the current cell in bold, italics, and single-underscored. Then it will move one cell to the right, ready…
This is from Microsoft Excel 2000 Visual Basic Help, with changes and additions. A Function procedure is a series of Visual Basic statements enclosed by the Function and End Function statements. A Function procedure is like a Sub procedure, but a function can also return a value. A Function procedure can take arguments, such as…
In an earlier post, we looked at connecting VBA code to command buttons on the Worksheet, the Quick Access Toolbar and the Ribbon. What about the other ActiveX Controls: The Combo Box, List Box, or Check Box? How about Option Buttons, the Scroll Bar, Spin button, Toggle button, etc.? That’s coming up in this post….
Windows stores program settings in the Registry, a Windows internal database. You can use this to remember previous user choices and use them as defaults the next time. We typically remember window positions, file paths, and other settings with the Registry. These three commands work with items stored in the Registry: SaveSetting appname, section, key,…