+ Reply to Thread
Results 1 to 7 of 7

Need a macro that will change a po. number it is printed

  1. #1
    Registered User
    Join Date
    03-03-2014
    Location
    Idaho
    MS-Off Ver
    Excel 2013
    Posts
    4

    Need a macro that will change a po. number it is printed

    I have a template that has been created in excel and I have a p.o. number in cell L1. I need to be able to print 3 copies of the same p.o. number and then have the number change to the next number and print 3 more copies. Like B1100, B1101, B1102, etc. I need to be able to print like from B1100 to B1150 and get three copies of each. I have spent an entire day trying to write the code and I just can't get it. Any suggestions.

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Need a macro that will change a po. number it is printed

    Maybe something like:

    Please Login or Register  to view this content.
    I'd test it out with maybe Do While x < 1105 so you don't accidentally print 150 copies of something you don't need.
    Last edited by daffodil11; 03-03-2014 at 08:33 PM. Reason: missed my quotes around "B"
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need a macro that will change a po. number it is printed

    So all you want to do is update the value in a certain cell on your Template to increment by one, then print 3 copies, then repeat for as many rounds as you'd like to indicate?

    1) Highlight the cell with the Invoice number in it and press CTRL-1 to open the Cell Format wizard, apply a CUSTOM number format of "B"0
    2) Now enter the starting NUMBER without the "B" into that cell... notice the cell Formatting puts the number back?

    This makes it easy to change the number in the cell because all that's IN the cell is a number, the "B" is added by formatting.
    The other benefit is that it means you can add different text other than B without having to modify the macro.

    ==========
    Let's assume that's cell A1 on your sheet "Template".
    Let's assume each time you run the macro you want the macro to ASK you how many copies of each to print, and how many times you want to increment and print.
    The macro will always start by incrementing the current value assuming that it was used in the prior "run".

    This would do that:
    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need a macro that will change a po. number it is printed

    Sitting here rereading the code, seeing "MyRuns" in there has given me fits of laughter.

  5. #5
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Need a macro that will change a po. number it is printed

    Almost makes me want to hide layers of innuendo in all the code I write going forward..

    Thanks!

  6. #6
    Registered User
    Join Date
    03-03-2014
    Location
    Idaho
    MS-Off Ver
    Excel 2013
    Posts
    4

    Re: Need a macro that will change a po. number it is printed

    This worked perfect. Thank you so much!
    Last edited by Alpinegp; 03-04-2014 at 02:30 PM.

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Need a macro that will change a po. number it is printed

    I've marked this thread as SOLVED for you.
    Next time, select Thread Tools from the links above to mark a thread as SOLVED. Thanks.

+ 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. number each printed copy
    By aschofield in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-14-2011, 11:14 AM
  2. Change Cell Value Based on the Page Being Printed
    By trickyricky in forum Excel General
    Replies: 1
    Last Post: 06-07-2011, 12:38 PM
  3. Number of pages to be printed
    By jonhfl in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 03-07-2011, 06:28 PM
  4. Indicate the row number for each last row in each new page printed
    By clng in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 12-03-2008, 10:41 AM
  5. New form number for each page printed
    By jimqual7 in forum Excel General
    Replies: 6
    Last Post: 03-20-2006, 12:30 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