How many lines of code can one module in VBA editor contain for Word or Excel?

Anonymous
2022-12-17T21:35:57+00:00

Hello everyone,

Just I want to ask How many lines of code can one module in VBA editor contain for Word or Excel and still works fine when executing code?

Microsoft 365 and Office | Word | For education | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. HansV 462.4K Reputation points MVP Volunteer Moderator
    2022-12-17T21:56:59+00:00

    There is no specific limit on the number of lines in a module.

    The total size of a code module should not exceed 64K (65536 characters) - beyond that, code will become unstable.

    EDIT (info provided by Colin Riddington):

    The 64K limit applies only to fixed or static data at module level, see also  
    https://www.isladogs.co.uk/code-module-size-limits/index.html and
    https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/fixed-or-static-data-can-t-be-larger-than-64k

    13 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2022-12-17T22:09:09+00:00

    There is no specific limit on the number of lines in a module.

    The total size of a code module should not exceed 64K (65536 characters) - beyond that, code will become unstable.

    Hi mister Hans,

    Thank you so much for the information.

    1 person found this answer helpful.
    0 comments No comments