Type-declaration character does not match declared data type

The data type of a variable can't be changed by appending the type-declaration character for another type. This error has the following cause and solution:

  • You declared a variable of a specific type, referenced a variable of the same name in the same scope, and then appended an inconsistent type-declaration character.

    If you want to be able to change the type of data assigned to a variable, declare the variable as a Variant. If you simply appended an incorrect type-declaration character, delete or change it.

For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.