XL: Square Bracket Notation Is Less Efficient Than Tunneling

ID: Q104502


The information in this article applies to:


SUMMARY

In the Microsoft Excel Visual Basic Programming System, Applications Edition (Visual Basic), you can use square bracket notation in some instances as an alternative to tunneling. For example, you could use [A1] instead of Range("A1") or [Sheet1!A1] instead of Sheets("Sheet1").Range("A1"). Using this abbreviated notation may take less time to enter as part of your procedure, but it takes longer to evaluate these statements at run-time. In addition, it is less flexible since you can't use variable names inside the square brackets.


MORE INFORMATION

Visual Basic goes through the following steps when it evaluates statements that use square bracket notation:

  1. Determines if the content is a module name.


  2. Determines if the content contains a range or object.


  3. Calls the EVAL() function which evaluates the contents as though it were a cell.


Depending on the size and function of your macro, this process may or may not have a noticeable affect on its efficiency. If you want to optimize your macro, use the longer tunneling notation instead.

Additional query words: 5.00a 5.00c 7.00a 97 XL97 XL7 XL5


Keywords          : 
Version           : 5.00 5.00c 7.00 | 5.00 5.00a
Platform          : WINDOWS 
Issue type        : 

Last Reviewed: April 7, 1999