Microsoft KB Archive/109674

From BetaArchive Wiki

Microsoft Knowledge Base

"Parenthesis do not Match" Error with FORMULA.REPLACE()

Last reviewed: September 12, 1996
Article ID: Q109674

The information in this article applies to:

  • Microsoft Excel for Windows, versions 4.0, 4.0a
  • Microsoft Excel for the Macintosh, version 4.0

SUMMARY

In Microsoft Excel versions 4.0 and later, when you run a recorded a macro that uses the FORMULA.REPLACE() macro function, you may receive the "Parentheses do not match" error message.

MORE INFORMATION

In Microsoft Excel versions 4.0 and later, if you forget to include the final closing parenthesis in a worksheet formula, Microsoft Excel automatically inserts one for you.

If you record a macro that uses the FORMULA.REPLACE() function to change a text string to a formula, you may receive a macro error when Microsoft Excel adds this missing closing parenthesis. For example, when you record a macro to change the text string "*=SUM($A$1:$A$2" to a formula by replacing "*=" with "=" (without the quotation marks), the formula is converted to =SUM($A$1:$A$2). When you run the recorded macro, you receive the "Parentheses do not match" error message.

Steps to Reproduce Problem

  1. In cells A1:A5, enter some random numbers.
  2. In cell C1, type:

          *=SUM($A$1:$A$2
  3. Drag the fill handle to the right to fill the formula through to cell F1.
  4. With the range C1:F1 selected, choose Record from the Macro menu. In the Name box, type "Replace" (without the quotation marks). Choose OK.
  5. From the Formula menu, choose Replace.
  6. In the Find What box, type "*=" (without the quotation marks) and in the Replace With box, type "=" (without the quotation marks). Choose the Replace All button.

Note that the text string in cell C1 is converted to a formula and that a closing parenthesis is automatically inserted at the end of the formula.

  1. From the Macro menu, choose Stop Recorder.
  2. Repeat steps 2 and 3.
  3. With the range C1:F1 selected, choose Run from the Macro menu, select the Replace macro from the Run list and choose OK.

You will receive the "Parentheses do not match" error message.

REFERENCES

"Function Reference," version 4.0, page 174


KBCategory: kbusage

KBSubcategory:

Additional reference words: 4.00 4.00a



THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: September 12, 1996
©1997 Microsoft Corporation. All rights reserved. Legal Notices.