+ Reply to Thread
Results 1 to 13 of 13

Macro to fit items on a roll with specific length

  1. #1
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Macro to fit items on a roll with specific length

    Dear all,


    please have a look at the attached file. The task is to fit the items in Column A on rolls that are 17.5 meters long. Each item has a specific length which is defined in row 2. I would like a Macro to automatically draw a line as soon as the maximum length of 17.5 meters is reached. Then start with the next items until a maximum of 17.5 is reached and so on...


    Thank you !!
    Attached Files Attached Files
    Last edited by 6StringJazzer; 03-06-2014 at 04:29 PM. Reason: title typo

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,885

    Re: Marco to fit items on a roll with specific length

    This can be done with conditional formatting without a macro, if you are willing to use an extra column. My solution adds a column to show the running total length of the items on each roll. (It might be possible do this without the extra column but I couldn't think of one.) Then conditional formatting draws a line anytime the running total goes down, starting a new roll.

    The extra column can be hidden if you don't like the way it looks.
    Attached Files Attached Files
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Marco to fit items on a roll with specific length

    Hi, thank you! But I would need a macro because the sheet will be filled with data from another sheet, plus a macro could automatically draw a line ...

  4. #4
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Marco to fit items on a roll with specific length

    Actually, it works great !!!!!

  5. #5
    Valued Forum Contributor tony h's Avatar
    Join Date
    03-14-2005
    Location
    England: London and Lincolnshire
    Posts
    1,187

    Re: Marco to fit items on a roll with specific length

    elgato74.xlsx
    This may do it for you.

    the row colouring is conditional formattimg
    Attached Files Attached Files
    Last edited by tony h; 03-06-2014 at 04:07 PM. Reason: elgato requested a 2007 version


    click on the * Add Reputation if this was useful or entertaining.

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,885

    Re: Marco to fit items on a roll with specific length

    Quote Originally Posted by elgato74 View Post
    Actually, it works great !!!!!
    Does that solve your problem? If you really need a macro I can help with that too.

  7. #7
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Marco to fit items on a roll with specific length

    I think i was set on a macro with a nice button, but a formula seems so much quicker.

  8. #8
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,885

    Re: Macro to fit items on a roll with specific length

    I use macros all the time but if I can do it with a formula in a few minutes I usually prefer that.

    If your question has been answered please mark your thread as "Solved" so that members will know by looking at the thread title that your problem is solved. Go to the menu immediately above your first post to the thread and click on Thread Tools. From the dropdown menu select "Mark this thread as solved..."

    If a member helped you solve your problem, consider adding to their reputation by clicking on the star icon below their name.

  9. #9
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Macro to fit items on a roll with specific length

    Hi 6StringJazzer, could I ask for your Macro solution for this task ? I would appreciate it !

  10. #10
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,885

    Re: Macro to fit items on a roll with specific length

    Macro solution attached
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Macro to fit items on a roll with specific length

    Hello i love the NICE BUTTON ! But sadly, it draws the first seperator line and then spits out an "438" Error Object doesnt support this property or method ".TintAndShade = 0" . i am using almost the oldest Excel Version on the planet

  12. #12
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS 365 Family 64-bit 2502
    Posts
    26,885

    Re: Macro to fit items on a roll with specific length

    I have Excel 2010 and 2013 (dropped 2003 last year) so have no way to test this in 2002. I also do not know what limitations there are in VBA support in 2002. At first glance it appears that the TintAndShade property did not exist in 2002. I would suggest simply deleting that line ** code and trying again.

  13. #13
    Forum Contributor
    Join Date
    12-05-2008
    Location
    Germany
    MS-Off Ver
    365
    Posts
    580

    Re: Macro to fit items on a roll with specific length

    Yes, deleting the property did the trick. Thanks again & have a good day !

+ 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. [SOLVED] Macro to Count and Mark Items for Printing on Roll
    By elgato74 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-24-2013, 11:10 AM
  2. Roll Assgnment - Items per month count
    By DUBBAVEE in forum Excel General
    Replies: 1
    Last Post: 11-30-2011, 01:05 AM
  3. Creating a Marco to Replace a Specific Number with a Specific Letter in a Column
    By goldbeje in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-27-2011, 11:26 AM
  4. Function to work out area of items per roll
    By joesinla in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-14-2010, 08:44 AM
  5. Sorting Items by Length for a target length list.
    By Joe Bob Crain in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 11-06-2006, 12:46 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