XL2000: Error Message 450 When You Run Sample Code from Excel 2000 Help to Change the Style of a Range (285810)



The information in this article applies to:

  • Microsoft Excel 2000

This article was previously published under Q285810

SUMMARY

The Excel 2000 Visual Basic for Applications (VBA) Help topic for the Style object contains the following information:

Using the Style Object

Use the Style property to return the Style object used with a Range object. The following example applies the Percent style to cells A1:A10 on Sheet1.

Worksheets("sheet1").Range("a1:a10").Style.Name = "percent"

The code in the preceding documentation is incorrect. The Name property of the Style object is read-only. Therefore, the code causes the following error message to appear:
Run-time error '450':
Wrong number of arguments or invalid property assignment
To apply the Percent style to A1:A10 on Sheet1 as the sample intends, use the following code instead:
Worksheets("sheet1").Range("a1:a10").Style = "percent"
				

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbbug kbdocerr kberrmsg KB285810