Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Apr 2006
    Location
    Accra, Ghana
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Rebar Cutting List (Excel 2000)

    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

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Rebar Cutting List (Excel 2000)

    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

  3. #3
    Star Lounger
    Join Date
    Apr 2006
    Location
    Accra, Ghana
    Posts
    84
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rebar Cutting List (Excel 2000)

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •