Sign in with Microsoft
Sign in or create an account.
Hello,
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

Guided support in your browser can provide digital solutions for Office problems

Try guided support

The Macro Error message appears when there is an error in the macro that you were running.

The specified method cannot be used on the specified object for one of the following reasons:

  • An argument contains a value that is not valid. A common cause of this problem is trying to gain access to an object that does not exist; for example, Workbooks(5), when only three workbooks are open.

  • The method cannot be used in the applied context. Specifically, some Range object methods require that the range contain data. If the range does not contain data, the method fails.

  • An external error occurred, such as a failure to read or write from a file.

  • (This issue does not apply to Mac) A method or property cannot be used because of security settings. For example, the properties and methods of the VBE object for manipulating the Visual Basic for Applications (VBA) code that is stored in a Microsoft Office document are inaccessible by default.

    To turn on trusted access to Visual Basic Projects, do the following:

    1. Enable the Developer tab on the ribbon. See Show the Developer tab for more information.

    2. On the Developer tab, in the Code group, click Macro Security.

      The Code group on the Developer tab

    3. Under Developer Macro Settings, select the Trust access to the VBA project object model check box.

      For more information about how to use the method, search for the method name in Visual Basic Help.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?
By pressing submit, your feedback will be used to improve Microsoft products and services. Your IT admin will be able to collect this data. Privacy Statement.

Thank you for your feedback!

×