Capacity Constraints and Scheduling...

auballard

New Member
Joined
Mar 17, 2009
Messages
15
I have a list of parts that has x amount of minutes to produce. I have a limited capacity each week. I would like to create an easy way to create a "matrix" that shows how the production minutes can be distributed. I need to be able to change the capacity as necessary.

PartTotal MinutesWK1WK2WK3WK4WK5
1280280
220791640439
3420014811920799
4255211211431
5396396
6713493
71476
82288
Capacity19201920192019201920

<colgroup><col><col><col><col span="4"></colgroup><tbody>
</tbody>
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Try this:-
NB:- This code should cover all column "WKs" that are applicable (i.e. WK columns in sheet)
Code:
[COLOR="Navy"]Sub[/COLOR] MG08Nov08
[COLOR="Navy"]Dim[/COLOR] Rng [COLOR="Navy"]As[/COLOR] Range, Dn [COLOR="Navy"]As[/COLOR] Range, ac [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] hSum [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] vSum1 [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long,[/COLOR] vSum2 [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
[COLOR="Navy"]Dim[/COLOR] Lst [COLOR="Navy"]As[/COLOR] [COLOR="Navy"]Long[/COLOR]
Lst = Cells("1", Columns.Count).End(xlToLeft).Column
[COLOR="Navy"]Set[/COLOR] Rng = Range("B2", Range("B" & Rows.Count).End(xlUp))

[COLOR="Navy"]For[/COLOR] ac = 1 To Lst
   [COLOR="Navy"]For[/COLOR] [COLOR="Navy"]Each[/COLOR] Dn [COLOR="Navy"]In[/COLOR] Rng
     [COLOR="Navy"]If[/COLOR] Not Dn.Address = Rng(Rng.Count).Address [COLOR="Navy"]Then[/COLOR]
        vSum1 = Abs(Application.Sum(Rng.Resize(Rng.Count - 1).Offset(, ac)))
        vSum2 = Abs(Rng(Rng.Count).Offset(, ac))
        hSum = Abs(Application.Sum(Dn.Offset(, 1).Resize(, Lst)))
        
        [COLOR="Navy"]If[/COLOR] Not vSum1 = vSum2 And Not hSum = Dn.Value [COLOR="Navy"]Then[/COLOR]
            [COLOR="Navy"]If[/COLOR] (Dn.Value - hSum) < (vSum2 - vSum1) [COLOR="Navy"]Then[/COLOR]
                Dn.Offset(, ac).Value = Dn.Value - hSum
            [COLOR="Navy"]Else[/COLOR]
                Dn.Offset(, ac).Value = vSum2 - vSum1
            [COLOR="Navy"]End[/COLOR] If
        
        [COLOR="Navy"]End[/COLOR] If
    [COLOR="Navy"]End[/COLOR] If
  [COLOR="Navy"]Next[/COLOR] Dn
[COLOR="Navy"]Next[/COLOR] ac
[COLOR="Navy"]End[/COLOR] [COLOR="Navy"]Sub[/COLOR]
Regards Mick
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top