The information in this article applies to:
SUMMARY
You can use a Visual Basic for Applications macro to change a formula or a
value to text and vice versa. To change a formula or value to text, run a
macro that adds a hidden leading apostrophe in front of the formula or
value. To restore the formula or value, run a macro that removes the
apostrophe.
MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please see the following page on the World Wide Web: http://www.microsoft.com/support/supportnet/overview/overview.aspIn Microsoft Excel, you cannot view the formulas in a worksheet in one area of the worksheet and the results of the formulas in another area. Instead, you must edit the formulas so that they appear in text format. To do this, insert an apostrophe in front of the equal sign of the formula. An efficient way to do this is to use a Visual Basic for Applications procedure. Note that cells in which apostrophes are the first character are not affected by this procedure. The following procedure adds an apostrophe in front of text, values, or formulas in the current selection:
The following procedure removes the apostrophe in front of text,
values, or formulas in the current selection:
NOTE: You can restore a value that you changed to text by copying the
number 1, selecting the cells that contain the text you want to restore,
and using the Paste Special command on the Edit menu with the
multiplication operation.
REFERENCESFor additional information about changing a formula or value to text without using a macro, please see the following article in the Microsoft Knowledge Base: Q142895 No Match Errors with Replace and Lead ApostropheFor additional information about getting help with Visual Basic for Applications, please see the following article in the Microsoft Knowledge Base: Q163435 VBA: Programming Resources for Visual Basic for Applications Additional query words: XL97 XL7 XL5 5.00a 5.00c 7.00a
Keywords : kbprg kbdta kbdtacode PgmOthr PgmHowto KbVBA |
Last Reviewed: November 9, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |