Results 1 to 7 of 7

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

Threaded View

bralew Can't reduce code as my... 08-24-2017, 03:58 AM
xlnitwit Re: Can't reduce code as my... 08-24-2017, 05:12 AM
bralew Re: Can't reduce code as my... 08-24-2017, 05:21 AM
bralew Re: Can't reduce code as my... 08-24-2017, 05:33 AM
bralew Re: Can't reduce code as my... 08-24-2017, 05:28 AM
xlnitwit Re: Can't reduce code as my... 08-24-2017, 06:27 AM
bralew Re: Can't reduce code as my... 08-24-2017, 06:43 AM
  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:

    Me.ComboBox31.Value & Me.ComboBox61.Value = "HUBAC001"
    reduce the code Or is there an easier method I can use and not get too complicated for maintenance.

    Private Sub ComboBox53_Change()
    
    Select Case Me.ComboBox4.Value
    
        Case "4/100"
    
    
    If ComboBox53.Value = "M12" And ComboBox3.Value = "C" And UCase$(ComboBox52) = "CONICAL" Then 
                
                    Me.ComboBox31.Value = "HUBAC001"  'THE  HUB REQUIRED L/H
                    Me.ComboBox61.Value = "HUBAC001"  'THE  HUB REQUIRED R/H
                    Me.TextBox49.Value = Val(TextBox28.Value) * 4.725 'THIS IS WEIGHT OF HUB L/H
                    Me.TextBox90.Value = Val(TextBox83.Value) * 4.725 'THIS IS WEIGHT OF HUB R/H
                    Me.ComboBox32.Value = "BRNGA001"  'THE  BEARING L/H
                    Me.ComboBox62.Value = "BRNGA001"  'THE  BEARING R/H
                    Me.TextBox50.Value = Val(TextBox29.Value) * 0.097 'WEIGHT OF BEARING
                    Me.TextBox91.Value = Val(TextBox84.Value) * 0.097 'WEIGHT OF BEARING
                    Me.ComboBox33.Value = "NOT REQUIRED" 'STUB AXLE WASHER L/H
                    Me.ComboBox63.Value = "NOT REQUIRED" 'STUB AXLE WASHER R/H
                    Me.TextBox51.Value = Val(TextBox30.Value) * 0 'WEIGHT OF STUB AXLE WASHER
                    Me.TextBox92.Value = Val(TextBox85.Value) * 0 'WEIGHT OF STUB AXLE WASHER
                    Me.ComboBox34.Value = "NUTA002" 'THE AXLE NUT
                    Me.ComboBox64.Value = "NUTA002" 'AXLE NUT
                    Me.TextBox52.Value = Val(TextBox31.Value) * 0.05  'WEIGHT OF NUTA002
                    Me.TextBox93.Value = Val(TextBox86.Value) * 0.05  'WEIGHT OF NUTA002
                    Me.ComboBox35.Value = "510237"   'SPLIT PIN
                    Me.ComboBox65.Value = "510237"   'SPLIT PIN
                    Me.TextBox53.Value = Val(TextBox32.Value) * 0.01  'WEIGHT OF SPLIT PIN
                    Me.TextBox94.Value = Val(TextBox87.Value) * 0.01  'WEIGHT OF SPLIT PIN
                    Me.ComboBox36.Value = "HBCAP004"  'HUB CAP
                    Me.ComboBox66.Value = "HBCAP004"  'HUB CAP
                    Me.TextBox54.Value = Val(TextBox34.Value) * 0.04  'WEIGHT OF HUBCAP004
                    Me.TextBox95.Value = Val(TextBox89.Value) * 0.04  'WEIGHT OF HUBCAP004
                    Me.ComboBox37.Value = "NUTW001"   'THIS IS THE WHEEL NUT
                    Me.ComboBox67.Value = "NUTW001"   'THIS IS THE WHEEL NUT
                    Me.TextBox55.Value = Val(TextBox27.Value) * 0.025 'THIS IS WEIGHT OF NUTW001
                    Me.TextBox96.Value = Val(TextBox82.Value) * 0.025 'THIS IS WEIGHT OF NUTW001
    
    End If
    
    End Sub
    Last edited by bralew; 08-24-2017 at 04:43 AM.

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