+ Reply to Thread
Results 1 to 6 of 6

Compile Error: Procedure too large

  1. #1
    Registered User
    Join Date
    10-23-2008
    Location
    Denver
    Posts
    31

    Compile Error: Procedure too large

    While attempting to run a macro I am receiving the following error message:
    Compile Error: Procedure too large. Apparently the code for a procedure can't exceed 64K. The code that has been written is currently 99K. Is there a way around this? I don't think it is possible for me to break this into 2 different codes.

    Cheers,

    C

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Compile Error: Procedure too large

    Sure it is. Why do you think otherwise? A complicated procedure might have 300 lines of code.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-23-2008
    Location
    Denver
    Posts
    31

    Re: Compile Error: Procedure too large

    The code is running based on answers from Sheet1. I can't split it into multiple code because it is assigned to 1 push button. Is there a way to assign multiple macros to one push button?

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Compile Error: Procedure too large

    No, but you can call procedures in code modules from the sheet module.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    03-17-2014
    Location
    Manila
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Compile Error: Procedure too large

    Hi,

    I'm basically new with Excel Vba and Userforms and I have a problem too with compile error because the procedure is too large. I have basically 9 checkboxes and it will display on a textbox together with other inputs. This is basically the code:

    If GHR And Not MIDAS And Not CRM And Not CON And Not Henk And Not HAD And Not IOM And Not MYJOB And Not LEARN Then
    ws.Cells(newRow, 4).Value = "GHR - P07"
    GHR.Value = False
    MIDAS.Value = False
    CRM.Value = False
    CON.Value = False
    Henkel.Value = False
    HAD.Value = False
    IOM.Value = False
    MYJOB.Value = False
    LEARN.Value = False
    ElseIf MIDAS And Not GHR And Not CRM And Not CON And Not Henkel And Not IOM And Not MYJOB And Not HAD And Not LEARN Then
    ws.Cells(newRow, 4).Value = "MIDAS - P26"
    GHR.Value = False
    MIDAS.Value = False
    CRM.Value = False
    CON.Value = False
    Henkel.Value = False
    HAD.Value = False
    IOM.Value = False
    MYJOB.Value = False
    LEARN.Value = False
    ElseIf CRM And Not GHR And Not MIDAS And Not CON And Not Henkel And Not HAD And Not IOM And Not MYJOB And Not LEARN Then
    ws.Cells(newRow, 4).Value = "CRM - P39"
    GHR.Value = False
    MIDAS.Value = False
    CRM.Value = False
    CON.Value = False
    Henkel.Value = False
    HAD.Value = False
    IOM.Value = False
    MYJOB.Value = False
    LEARN.Value = False
    ElseIf CON And Not GHR And Not MIDAS And Not CRM And Not Henkel And Not HAD And Not IOM And Not MYJOB And Not LEARN Then
    ws.Cells(newRow, 4).Value = "CON - C07"
    GHR.Value = False
    MIDAS.Value = False
    CRM.Value = False
    CON.Value = False
    Henkel.Value = False
    HAD.Value = False
    IOM.Value = False
    MYJOB.Value = False
    LEARN.Value = False

    and so on until all possible combinations on the below checkboxes are satisfied:

    sample_checkbox.jpg

    My question is, can my code be coded to a more simpler code to avoid the "procedure too large" error? Thanks guys in advance!

    Andy

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Compile Error: Procedure too large

    Why do you need to check every checkbox each time?

    Why do you need to reset nearly every checkbox each time?

    What exactly do you want to happen when multiple checkboxes are selected?
    If posting code please use code tags, see here.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1