Excel Visual Basic Variables, Part 1: Variable Types
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.
This is from Microsoft Excel 2000 Visual Basic Help, with changes and additions. All arguments are passed to procedures by reference, unless you specify otherwise. This is efficient because all arguments passed by reference take the same amount of time to pass and the same amount of space (4 bytes) within a procedure regardless of…
1. The Application Keyword Use “Application” to refer to Excel, e.g.: Application.ActivePrinter Name of the Active Printer.Application.Name Name of the program running (“Microsoft Excel”).Application.Path The path from which the program is running. 2. ActiveControl Instead of the name of a specific control (e.g. txtEdit), you can use the keyword ActiveControl. This will let your program refer…
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 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…
We had an earlier post, How to Use Objects, Collections, Properties, Events and Methods in Excel Visual Basic. There, we introduced the idea of Objects and Collections. We listed the most useful Objects, and Collections of Objects. Below we have more extensive diagrams, specifically for the Excel Object Model. It helps to understand the hierarchy:…
In our previous post, we looked at connecting VBA code to command buttons on the Worksheet, the Quick Access Toolbar and the Ribbon. What about the other Form Controls: The Combo Box, List Box, or Check Box? How about Option Buttons, the Scroll Bar, the Spin button, the Label, etc.? That’s coming up in this…