Else clause must be preceded by a matching If
Else is a conditional compilation directive. This error has the following cause and solution:
An #else
clause was detected that isn't preceded by a matching #if
or #elseif
. Check to see if a preceding #if
has been separated from this #else
by an #endif
. Note that only one #else
is permitted in each #if
block, so two successive #else
clauses cause this error.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).
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.