+ Reply to Thread
Results 1 to 4 of 4

Procedure too large when running a macro

  1. #1
    Forum Contributor
    Join Date
    03-24-2010
    Location
    North West UK
    MS-Off Ver
    2013
    Posts
    112

    Procedure too large when running a macro

    Hi all,

    I've attached my example spreadsheet to show what I'm trying to do.

    On Sheet 2 is the raw data. What I have had to do is record 2 Macros to try and achieve what I want but when running macro Format2 I'm getting an error message saying the "Procedure is too large". Macro Format1 does the initial piece of formatting I want but ideally I'd want one macro to do it all.

    What I want to do exactly is this:

    Dump raw data into the spreadsheet (exactly like what is in Sheet 2 but the amount of lines will differ so I don't want anything set in regards to how much to select).

    Then delete columns I-U: inclusive
    Delete rows 1-9 inclusive
    Remove the column merge on columns A-B
    Then remove column B
    Then auto width the column of A so that it is long enough to see all the names
    Remove column merge on D-E
    Remove column E and auto width it then centre everything in that column
    Remove line 2 (which is blank)

    Sheet 1 shows the end product

    Any suggestions would be great,
    Thanks,
    Lew
    Attached Files Attached Files

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Procedure too large when running a macro

    Let's start with this.
    Please Login or Register  to view this content.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,483

    Re: Procedure too large when running a macro

    This is an example where the macro recorder does not work to well what it does is change the cell format cell by cell since you selected col A and B it looks like it is trying to do it 2 miljon times or so. it might even qualify as a bug of the macro recorder to do it this way.

    Your request is not that exotic and requires only simple code
    I think below macro does all you ask above.

    Please Login or Register  to view this content.
    note: I choose to build the macro based on your listed actions.
    It could be made a little more efficient to VBA coding standards. But that won't affect speed much. This is easier to understand what each line of code does exactly.

  4. #4
    Forum Contributor
    Join Date
    03-24-2010
    Location
    North West UK
    MS-Off Ver
    2013
    Posts
    112

    Re: Procedure too large when running a macro

    That is brilliant, thank you very much!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Excel Macro Procedure Too Large Error - Help
    By sanjaydutta2002 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-29-2015, 05:25 AM
  2. [SOLVED] Trouble running delete rows macro for large excel file
    By MSDemocrat in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-13-2014, 09:13 AM
  3. Compile error: Procedure too large. Executing macro via hyperlink.
    By rain4u in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 06-03-2011, 10:07 PM
  4. Macro code too long: "Procedure too large" Error
    By nachousa in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-27-2010, 03:16 PM
  5. Replies: 1
    Last Post: 01-14-2010, 12:52 PM
  6. Instructions required for breaking up large recorded macro procedure
    By W2009 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-24-2009, 10:57 AM
  7. Excel Macro - Procedure Too Large
    By saeed9313 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 10-15-2008, 01:41 PM

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