+ Reply to Thread
Results 1 to 6 of 6

Procedure too large

  1. #1
    Registered User
    Join Date
    11-10-2011
    Location
    Leicester, UK
    MS-Off Ver
    Office 2013
    Posts
    21

    Procedure too large

    Hello all

    I have a procedure which is run from a click of a button, in this instance a continue button

    It is a long piece of code and there is still more to come.

    Can anybody help me shorten this code as I cannot understand how to shorten it myself.

    I know this is probably too much too ask, but I really struggling as I am a bit of a novice when it comes to VBA.

    I have added the code as it is a .txt file as it is too large to past onto here!

    Many thanks in advance.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Procedure too large

    *Frightening*

    AS you have discreet blocks for various carriers and services and most of the data seems to be static for each block, you could do something like...

    Please Login or Register  to view this content.
    That reduces the code from 180+ lines to 48 (or so) for the first block alone.

    Add corresponding procedures for each block of code.

  3. #3
    Registered User
    Join Date
    11-10-2011
    Location
    Leicester, UK
    MS-Off Ver
    Office 2013
    Posts
    21

    Re: Procedure too large

    Hi

    Thank you for this.

    I will have a look and respond if it works, which I am sure it will

    Yes it is frightening

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Procedure too large

    ...and respond if it works
    And if it doesn't work... just going to forget about it?

  5. #5
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Procedure too large

    Hi

    Your procedure is more like a database

    Put all your data into a very hidden worksheet

    Access that sheet using the procedure.

    The following code will change a text string into a Row number.
    The procedure therefore can therefore copy your range from the hidden sheet into your display area.

    So your procedure should be reduced to something like 20 lines.

    Simples.


    Please Login or Register  to view this content.
    Last edited by mehmetcik; 03-27-2013 at 04:52 PM.

  6. #6
    Registered User
    Join Date
    11-10-2011
    Location
    Leicester, UK
    MS-Off Ver
    Office 2013
    Posts
    21

    Re: Procedure too large

    Many thanks Cytop

    This has worked wonders. I am now using it in other places to tidy up my scripts. So thank you very very much

+ 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