• Rebar Cutting List (Excel 2000)

    Author
    Topic
    #433817

    Hallo Everybody

    I got a small program to work out the optimum way to cut different lengths of rebar out off full lengths. Although the results are not bad and will not make a very big difference once you cut thousands of bars, the code could be better. I just do not know how to make it better.

    I attach the workbook with the code and some sample data. The column with the red figures are the off cuts remaining.
    With the current data as entered and calculated with method one ( Just press the Button with Method One one it) you will notice some off cut lengths remaining. The remaining off cuts are enough to cut another 48 pieces of 150mm length. If you now enter this extra data in the Yellow boxes marked ( (Enter the 150 in the Length box and the 48 in the number box.) and run the macro again you will notice that instead of using this off cuts it rather come up with a different cutting list and add some lengths to the required number of lengths

    Does someone has better code or make suggestions as how to improve this code. Any advise or assistance will be greatly appreciated.

    Regards

    Viewing 0 reply threads
    Author
    Replies
    • #1021400

      I haven’t studied the code in detail (that is outside the scope of the Lounge, I think), but I have a recommendation or two:

      1) Selection

      In most situations, it is not necessary to select cells to manipulate them. Code will run more efficiently if you don’t. For example, the lines

      Sheets(“This”).Select
      Range(“A1:B10”).Select
      Selection.Copy
      Sheets(“That”).Select
      Range(“C1”).Select
      Selection.Paste

      can be replaced with

      Sheets(“This”).Range(“A1:B10”).Copy Destination:=Sheets(“That”).Range(“C1”)

      Not only is this much shorter, it also avoids the screen flicker caused by switching between sheets.

      2) Screen updating

      You can make code run a bit faster by not updating the screen while it runs. Add the following line at the beginning:

      Application.ScreenUpdating = False

      and at the end

      Application.ScreenUpdating = True

      • #1021411

        Hans

        Thank you very much once again. I will implement your recommendations.

        If you are interested in developing the code further maybe through your business or privately, please let me know how I can make contact to discuss cost involved

        As always I am grateful for the help I am getting through the Forum, but I am also prepared to pay for work outside the scope of the Forum.

        Regards

    Viewing 0 reply threads
    Reply To: Rebar Cutting List (Excel 2000)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: