+ Reply to Thread
Results 1 to 20 of 20

Macro to automatically workout number of labels and pages numbers

  1. #1
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Macro to automatically workout number of labels and pages numbers

    So, as per attached file, I have list of stores in DATA worksheet. This whole page will be pasted into worksheet every time the sheet will be used.
    I want this macro to tell me how many labels I need to print I need 1 label per 25 cases, so for example if I have 51 cases ordered per store I will need 3 labels printed. That will increase with every 25 cases that store will order.
    My labels are saved in PDF file (1 store per page per label) so I dont need to know which store number it is but page that this store is on. Number of pages are represented by small digits in row 8, 11,14 for example. I need this macro to return information:
    1. about how many labels I need for every store (given its 1 label per 25 cases)
    2. number of page it is on needs to be multiplied in the same cell separated by comma
    3. all of the numbers from all stores needs to be consolidated in one cell, separated by comma.
    4. PDF can only allow 99 characters to be put in pages print option so it would be good if this string of data would be separated into strings of no more than 99 characters.
    5. This is to be done in Summary tab after pressing the button.
    Could anyone be of any help with this?
    Attached Files Attached Files

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    Hi dpodraza

    What format/layout must the info be in Summary Sheet?
    all of the numbers from all stores needs to be consolidated in one cell, separated by comma.
    All of what numbers?
    Last edited by sintek; 02-18-2018 at 11:04 AM.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Re: Macro to automatically workout number of labels and pages numbers

    Hi sintek,

    Just General formatting, number separated by commas.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    Yes but how must the sheet look....
    Give this a go...Still don't quite get ...
    all of the numbers from all stores needs to be consolidated in one cell, separated by comma.
    All of what numbers?
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Re: Macro to automatically workout number of labels and pages numbers

    Hi again,

    Please see attached for format I would like to use. Button should be set up for execution the macro.

    "all of the numbers from all stores needs to be consolidated in one cell, separated by comma."

    By this is mean - I need this macro to return to me page numbers that the label is on and needs to be printed also repeated as many times as needed. Page numbers are in line 8 for instance.

    For example I need to print 2 labels for store 17, 3 labels for store 26 and 4 labels for store 258 (data from spreadsheet).

    Then string that should be pasted into D9 cell in Summary tab should be: 1,1,2,2,2,3,3,3,3.

    I understand it is confusing to understand as I find it very confusing to explain. Does this make more sense now?
    Attached Files Attached Files

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    Struggling with this one as I cannot see how the cell can only contain 99 characters...some nums are 2 digits??
    Perhaps someone else can solve...Upload is my attempt...Good luck

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by sintek; 02-18-2018 at 02:30 PM.

  7. #7
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Re: Macro to automatically workout number of labels and pages numbers

    Hi sintek,

    Words can't describe my admiration to what has been achieved in this thread by you! This is simply fantastic piece of work - with writing macro itself and understanding what my needs are!

    May I just ask you for one change to the file - although it works perfectly, as you could see from attached file I have increased numbers of lines in SUMMARY tab so I could decrease number of digits in one line to 70.
    Could you please amend the file for me accordingly?

    I will explain why I need this - while using Adobe Reader I have one label per page set up. When I try to print labels I can either print whole lot or chose specific pages which will be printed. Amount of labels that I need to print changes depending on the store needs.
    If I put more than 70 digits in Print->Pages to print->'Pages' option, Adobe will not print all of these for me. At first I thought it would accept up to 100 digits in this line, however I can type up to 100 digits in the line but it will always only print labels if I don't go over 70 digits in this line.

    Hope it make sense...

    If you could one more time amend my spreadsheet I would be really grateful.

    Thanks!

    EDIT:

    sintek, thanks one more time for all your help, however I managed to find and amend options that I need to save you some time!
    Attached Files Attached Files
    Last edited by poodek; 02-18-2018 at 05:27 PM. Reason: found out solution

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    Change this line...
    Please Login or Register  to view this content.
    to
    Please Login or Register  to view this content.
    or play around with the red part...

    Thanks for rep + ... If this solves, please mark thread as such
    Last edited by sintek; 02-19-2018 at 02:20 AM.

  9. #9
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Re: Macro to automatically workout number of labels and pages numbers

    Hi sintek,

    Thanks for your help with all of these functions!

    I will mark the thread when it's ready however today's day brought some more challenges. I have successfully used the macro in one of the instances I needed it for, however I need to amend some of it.

    So, I have realized that number of my stores will be increasing (not sure to what number) hence I would need the file to be able to accept more lines into the macro.
    For example on previously attached file I pasted one page with data into DATA tab (which has 49 lines). Now I need to be sure that if I paste 2 or 3 pages of the data at the same time, one after another it would still work and work out the pages needed.

    Another thing is the issue that comes up in summary tab. As per attached file you can see that when macro is executed in cell D16 onwards it will change formatting from 'General' to 'Number' and instead of page numbers only separated by commas. Although I try to change it, after macro is executed it changes formatiing to how it was before.

    Finally... I have worked out that apart from Adobe having issue with length of the characters in one line, it can also only print 24 labels per one shot.
    Could you please set up another condition that would only allow there to be 24 numbers per line? I still need to keep 70 characters per line though.

    Thank you in advance for your help with this. I have tried to work it out on my own, however I am afraid my knowledge about these things is still too limited to be able to build it on my own... I keep on learning though!!!
    Attached Files Attached Files

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    Could you please set up another condition that would only allow there to be 24 numbers per line? I still need to keep 70 characters per line though.
    Bit of a contradiction...So what is it 24 numbers and 23 commas = 47 characters...If you want 70 characters then you gonna have more than 24 numbers...

    Will have a look tomorrow morning...

  11. #11
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Re: Macro to automatically workout number of labels and pages numbers

    Sorry - what I meant is that I can only print 24 labels at one go. This is why I need there to be only 24 numbers but not going over 70 characters as well.

    Thanks again.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    also the code wont work if the page no's aren't in

  13. #13
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Re: Macro to automatically workout number of labels and pages numbers

    Could we embedd pages numbers in DATA sheet so it would always show up even if I paste data on it? That would be in cell L49, L98 and so on (as in attached sheet).

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    Have a look at attached...had to change code as their was no more pattern...i.e step 3...
    Please Login or Register  to view this content.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Re: Macro to automatically workout number of labels and pages numbers

    Hi there,

    Macro works fine until cell C18 Summary tab where number of characters in cell exceeds 70 and all lines below will have wrong formatting and return values like
    1.46147147148148E+17,149,149,150,150,150,151,151,152,153,154,155,156,156,157,158,158,159,159,160,161,162,163,164

  16. #16
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    Could we embedd pages numbers in DATA sheet so it would always show up even if I paste data on it? That would be in cell L49, L98 and so on (as in attached sheet).
    I was referring to this ...
    which store number it is but page that this store is on. Number of pages are represented by small digits in row 8, 11,14 for example.
    Macro works fine until cell C18 Summary tab
    What file are you making use of for testing...Thus far all your uploads have been different?
    1.46147147148148E+17,149,149,150,150,150,151,151,152,153,154,155,156,156,157,158,158,159,159,160,161,162,163,164
    None of your uploads go as high as 164???


    Edit....Have made inquiries into format issue at this link...
    https://www.excelforum.com/excel-pro...mat-issue.html
    Last edited by sintek; 02-20-2018 at 03:19 AM.

  17. #17
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Re: Macro to automatically workout number of labels and pages numbers

    Quote Originally Posted by sintek View Post
    I was referring to this ...
    All of these page numbers are there however in white colour so it wouldn't be visible on the print out.


    Quote Originally Posted by sintek View Post
    What file are you making use of for testing...Thus far all your uploads have been different?

    None of your uploads go as high as 164???
    To make sure it works if more stores are added to it I have added some more in DATA tab starting from row 58 onwards to 76 to see if it will work correctly.

    The file is the same one but with more stores added to it
    Attached Files Attached Files

  18. #18
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    Here we go...thanks to xlnitwit
    Now just to solve the char count and num count issue...
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by sintek; 02-20-2018 at 04:06 AM.

  19. #19
    Registered User
    Join Date
    02-15-2018
    Location
    England
    MS-Off Ver
    365
    Posts
    34

    Re: Macro to automatically workout number of labels and pages numbers

    Hi there,

    I have tested the file today and it has been working great, there were no issues observed for now and hoping this will stay this way

    There are some idea and plans to improve it but I think the focus now is to make sure it works fine without any problems and then I may ask for some more help.

    Amazing piece of work, many thanks for your help on that, it is greatly appreciated!

  20. #20
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,159

    Re: Macro to automatically workout number of labels and pages numbers

    Glad we got it sorted...Please mark as solved. I suggest for any further developments...you open a new thread.

+ 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 automatically find last entry on page and print only pages with data
    By Chris McGlothen in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-29-2016, 05:12 PM
  2. I need a Macro to automatically import web pages
    By Bret1 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-24-2013, 05:56 PM
  3. [SOLVED] Macro to number pages
    By HDMI in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2013, 03:24 PM
  4. [SOLVED] Macro To Make The Number Of Pages To Print Selectable
    By LoneWolf3574 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-05-2012, 02:50 AM
  5. [SOLVED] Can I automatically select the number of pages to print?
    By Husker87 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-27-2005, 12:25 PM
  6. How to automatically change number of pages to print?
    By Husker87 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-25-2005, 10:35 AM
  7. Replies: 1
    Last Post: 07-29-2005, 08:05 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