Using FORMULA.CONVERT() to Change Relative/Absolute ReferencesLast reviewed: August 23, 1996Article ID: Q70096 |
The information in this article applies to:
SUMMARYYou can use the FORMULA function with the FORMULA.CONVERT function to change every reference in a selected area from relative to absolute reference. You can do this by using the FORMULA.CONVERT function to calculate the first argument, formula_text, of the FORMULA function. However, because the FORMULA function will fail if you attempt to use A1-style references, you need to make sure that the FORMULA.CONVERT function is returning an R1C1-style formula and not an A1-style formula.
MORE INFORMATIONThe third argument of the FORMULA.CONVERT function, To_a1, determines whether an A1-Style or R1C1-style reference is returned.
ExampleThe following macro is a short example that will convert all the references in the currently selected area into absolute references. NOTE: This macro assumes that the references in the selected area are currently in A1-style. If you want to select an area that contains relative references in R1C1-style, change the second argument of the FORMULA.CONVERT function from TRUE to FALSE.
A1: =FOR.CELL("curcell",,TRUE) A2: =FORMULA(FORMULA.CONVERT(GET.CELL (6,curcell),TRUE,FALSE,1,curcell),curcell) A3: =NEXT() A4: =RETURN() NOTE: The third argument of the FORMULA.CONVERT function must be FALSE to use the FORMULA.CONVERT function to return the formula_text argument to the FORMULA function. If this third argument is TRUE, or if the formula_text argument uses A1 style references and this third argument is omitted, you will receive a macro error. For an example of how to perform this function using a Visual Basic for Applications macro, see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q116028 TITLE : XL: VB Macro to Change Between Relative/Absolute References REFERENCES"Function Reference," version 4.0, pages 168-171 "Microsoft Excel Function Reference," version 3.0, pages 89-91
|
KBCategory: kbprg kbcode
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |