Posted by Andrew Schuster on Sep 8, 2013 in Tutorials |
Today I’d like to talk about an important issue that pertains to the performance of VBA code in Excel. What I’m referring to is the use of .Activate
. To be honest, I can’t think of a time when that function should ever be called in VBA code. The method is very much designed for visual identification of a focused object in the user interface (UI), and not the manipulation of underlying properties. Using the .Activate
function carries a curtain amount of overhead that is not required when all you are doing is iterating through a range of cells. As an example I’d like to show you two separate snippets of code. The first example iterates through all the cells in a range using the .Activate
approach, while the second merely iterates through the same cells without activating any of them:
Posted by Andrew Schuster on Sep 7, 2013 in Tutorials |
One thing VBA programmers often grapple with is whether or not to use .Activate
or .Select
when working with objects like worksheets and cells. So what is the difference, and when would you use one method over another? To put it simply, .Activate
sets focus to a single object, while .Select
allows for multiple items to be selected. As an example, you can select multiple cells on a worksheet, but only one of those cells can be active at any given time.
Posted by Andrew Schuster on Sep 4, 2013 in Tutorials |
The Excel object model closely follows that of the User Interface (UI) making the transition from end user to developer much easier. At the top of the object model we have the Application object. This object contains application wide settings (ie. many of the options found in the options dialog under the tools menu), as well as properties like ActiveSheet and ActiveCell.
Posted by Admin on Sep 3, 2013 in Tutorials |
- On the File tab, choose the Options button.
- In the Options dialog box, choose the Customize Ribbon button.
- In the list of main tabs, select the Developer check box.
- Choose the OK button to close the Options dialog box
Posted by Admin on Sep 3, 2013 in Tutorials |
- On the File tab, choose the Options button.
- In the Options dialog box, choose the Customize Ribbon button.
- In the list of main tabs, select the Developer check box.
- Choose the OK button to close the Options dialog box