Microsoft KB Archive/104502

From BetaArchive Wiki
Knowledge Base


Square Bracket Notation Is Less Efficient Than Tunneling

Article ID: 104502

Article Last Modified on 8/15/2003



APPLIES TO

  • Microsoft Excel 97 Standard Edition



This article was previously published under Q104502

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 XL

Keywords: KB104502