The information in this article applies to:
SUMMARYIn Microsoft Excel, when you use the GoTo method in a Visual Basic for Applications procedure, you must use a Visual Basic object style reference, such as the following:
However, many functions that return worksheet or chart values return the
<SheetName>!<CellReference> style reference.
Using string manipulation, it is possible to take a <SheetName>!<CellReference> style reference result and use it as an argument of the Range method. The Range method then converts a <SheetName>!<CellReference> style reference to a Visual Basic object style reference that can be used with the GoTo method. The following are examples of using the Range method to accomplish this. MORE INFORMATIONConverting Link FormulaTo convert a simple Microsoft Excel link formula, for example "=Sheet1!$A$1" to a Visual Basic style reference, you can strip the equal sign (=) from the left side of the string and pass the remainder of the formula to the Range object.The following line of code selects the cell or range that is referenced by the formula in the active cell:
Converting Reference in Chart SeriesTo select a range that is referenced as a y value in the formula of a chart series, the string manipulation becomes a bit more complex. The following procedure strips the section of the series formula between the second and third commas of the currently selected series and passes that string to the Range object to select it.
REFERENCES
"Visual Basic User's Guide," version 5.0, Chapter 3, "Creating User
Defined Functions"
Additional query words: 5.00c 8.00 97 XL97
Keywords : xlvbahowto |
Last Reviewed: December 28, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |