Bewerken

Delen via


Destination label too far away; loop, Select Case, or block If too large

Procedures can be as large as 64K from beginning to end, but because branching can occur either forward or backward within a procedure, such branching is limited to 32,767 bytes in either direction. This error has the following causes and solutions:

  • You have a branching statement (GoTo, GoSub) whose destination label is farther away than 32,767 bytes from the source branching statement. Move the label closer, or make the procedure smaller.

  • You have a very large loop structure that occupies more than 32K of memory from beginning to end. Make the loop smaller.

  • You have a very large block If structure that contains a Then or Else clause that occupies more than 32K of memory from beginning to end. Reduce the size of the offending portion of the structure.

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.