+ Reply to Thread
Results 1 to 7 of 7

Can't reduce code as my procedure is too large.

  1. #1
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Can't reduce code as my procedure is too large.

    Hi All,

    I have a message on my UserForm that informs me my procedure is too large. The code below represents one of 60 variations and as you can see it
    can be quite large. As you can deduce from the code, there is a left and a right which mirrors each other. The reason for this simplicity is so
    I can easily edit and not lose my freedom when variations all called for. However, this is not possible and 99.9 per cent of the time the Left
    mirrors right.

    My question is this. Would having a line such as:

    Please Login or Register  to view this content.
    reduce the code Or is there an easier method I can use and not get too complicated for maintenance.

    Please Login or Register  to view this content.
    Last edited by bralew; 08-24-2017 at 04:43 AM.

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Can't reduce code as my procedure is too large.

    Hi,

    It would reduce the code but it wouldn't work.

    I imagine you should be refactoring the code so that any common parts go into separate routines that can be called from anywhere, and probably using some sort of lookup table logic. I think I've mentioned this to you before for precisely this reason and you said you were too far down the road to change, but now you know why I said it.

    In an ideal world, all the actual business logic would be in its own classes and the form would merely call its methods to pass/retrieve any relevant data. FWIW.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't reduce code as my procedure is too large.

    I know, I appreciate your guidance and this day is not wholly surprising, I must think harder, Lol, cheers for assistance :-)

  4. #4
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't reduce code as my procedure is too large.

    I've read that if I put wheel data (which several of the userforms use as common data) in a mutual module this is more beneficial. This seems obvious I know. If I can achieve this, then I think I can work my way through this and start reducing code.
    Can you hold on to this thread to guide me, I'll post what I'm doing?

  5. #5
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't reduce code as my procedure is too large.

    I've put this into Userform 3 as a button to fire the data (its much larger than this but this suits the example). By using a button, I can allow the other userforms to access this data from a module and delete it from the userform. The problem I'm having is: how does the module tell which ComboBox10 to read(because ComboBox10 exists in all userforms)? Can it intelligently deduce that that CommandButton6 is located in the userform3. At the moment, it does nothing?


    Please Login or Register  to view this content.

  6. #6
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Can't reduce code as my procedure is too large.

    All the control references refer to the userform holding the code unless otherwise specified.

  7. #7
    Forum Contributor
    Join Date
    07-05-2016
    Location
    cardiff
    MS-Off Ver
    2010
    Posts
    787

    Re: Can't reduce code as my procedure is too large.

    Yes, I see. I'm going to come back to this. I found a method whereby I can copy the previous examples left to right using a command button. You've made me think. 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. Replies: 8
    Last Post: 07-25-2017, 06:54 AM
  2. Replies: 1
    Last Post: 11-22-2016, 01:54 AM
  3. Spreadsheet size is too large - any tips to reduce the size?
    By Jessica.Bush in forum Excel General
    Replies: 9
    Last Post: 11-11-2015, 02:45 PM
  4. Replies: 3
    Last Post: 01-23-2014, 10:13 AM
  5. how can i reduce this code
    By newapa in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-19-2012, 04:44 AM
  6. Delete multiple rows to reduce size of large spreadsheet
    By The Geologist in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-02-2011, 01:54 PM
  7. reduce print size on large sheet
    By eneu in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-01-2007, 01:25 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