Excel: Increasing Efficiency in Looping Over a Region of CellsLast reviewed: April 3, 1997Article ID: Q51843 |
2.20
MACINTOSH
kbother
The information in this article applies to:
SUMMARYIn Microsoft Excel, when you need to loop over a region of cells (such as to perform some repetitive operation), use the OFFSET() or INDEX() command instead of concatenating a reference string. The typical macro written to loop over a region of cells may look like the following:
=FOR("i",1,10) =FORMULA("10","TEST.XLS!R"&i&"C1") =NEXT()The above macro can be replaced by the faster version shown below:
=FOR("i",0,9) =FORMULA("10",OFFSET(TEST.XLS!R1C1,i,0)) =NEXT() MORE INFORMATIONThis information was taken from page 153 of the "Microsoft Excel Technical Reference for the Macintosh," which can be obtained by calling Microsoft End User Sales and Service at (800) 426-9400. Note: Page 153 displays an incorrect example of the loops because it does not include the parentheses after the NEXT() statement.
|
KBCategory: kbother
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |