Microsoft KB Archive/119571

{|
 * width="100%"|

XL5: GP Fault Using PATTERNS Formula with Cell Selected

 * }

-

The information in this article applies to:


 * Microsoft Excel for Windows, version 5.0

-

SYMPTOMS
In Microsoft Excel version 5.0, if you run a MS Excel 4.0 macro that contains the PATTERNS formula, you receive a general protection (GP) fault if a cell on a worksheet or macro sheet is selected.

CAUSE
This behavior only occurs if you use one of the syntax forms of the PATTERNS formula for a chart item, or object, while a cell is selected on a worksheet or macro sheet. The problem occurs because the syntax forms of the PATTERNS formula for a chart item or object contain up to 12 arguments, while the syntax form for a cell contains only 4 arguments. If you use one of the syntax forms of the PATTERNS formula that contain more than 4 arguments, while a cell is selected, you receive a GP fault.

WORKAROUNDS
To avoid receiving a GP fault when you use the PATTERNS formula, do either of the following:


 * Select the chart item or object that you want to apply the pattern to before you use the macro that contains the PATTERNS formula.
 * Activate the chart item or object that you want to format within the macro that contains the PATTERNS formula. In the following example, the plot area on Chart1 is selected, and then the PATTERNS formula is used:

Microsoft provides macro 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 macro is provided as is and Microsoft in no way guaranties that the following code can be used in all situations and will not support modifications of the code to suit specific customer requirements.

  A1: =WORKBOOK.SELECT("Chart1","Chart1") A2: =SELECT("Plot") A3: =PATTERNS(0,1,8,3,FALSE,0,1,2,2,FALSE,FALSE,FALSE) A4: =RETURN

STATUS
Microsoft has confirmed this to be a problem in the Microsoft products listed at the beginning of this article. This problem was corrected in a later version of Microsoft Excel.

In Microsoft Excel version 5.0c, if you use the incorrect syntax form of the PATTERNS formula while a cell is selected, you receive a macro error instead of a GP fault.