+ Reply to Thread
Results 1 to 11 of 11

Macro to increment a number up and print in reverse

  1. #1
    Registered User
    Join Date
    01-18-2018
    Location
    North EAst, UK
    MS-Off Ver
    2013
    Posts
    5

    Macro to increment a number up and print in reverse

    Hi All

    I have a macro and the moment that works by incrementing a number in sequence 1,2,3,4,5,6,7
    but when it prints it does so by 1.2.3.4.5.6.7

    Please Login or Register  to view this content.
    but then I have to stand and put the pages 7.6.5.4.3.2.1 manually so that 1 is the first page you pickup.

    Ideally I would like macro to increment up 1,2,3,4,5,6,7 but print 7.6.5.4.3.2.1 as when I do a print run of 100 sheets it gets a bit tedious reordering the sheets manually, this is for a 1 page data capture sheet, once I get to printing 200 sheets a time it will get a bit time consuming...

    Total Macro novice..

    Many Thanks

  2. #2
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Macro to increment a number up and print in reverse

    Welcome to the forum

    Untested - but looks logical

    Please Login or Register  to view this content.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  3. #3
    Registered User
    Join Date
    01-18-2018
    Location
    North EAst, UK
    MS-Off Ver
    2013
    Posts
    5

    Re: Macro to increment a number up and print in reverse

    Hi Kev_

    yes that seemed logical to me as well but it kills the macro....

  4. #4
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Macro to increment a number up and print in reverse

    So you have the macro counting 1 to 7 and it works and now it is counting from 7 to 1 and it doesn't work

    There must be a silly typo somewhere - try replacing the full macro and try it again

  5. #5
    Registered User
    Join Date
    01-18-2018
    Location
    North EAst, UK
    MS-Off Ver
    2013
    Posts
    5

    Re: Macro to increment a number up and print in reverse

    hi kev_

    For I = P To 1 Step -1
    kills the macro and does not step or print

  6. #6
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Macro to increment a number up and print in reverse

    I have just tested the macro - it works for me (both ways)


    Here is another method
    Please Login or Register  to view this content.
    Last edited by kev_; 01-18-2018 at 11:45 AM.

  7. #7
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Macro to increment a number up and print in reverse

    You need to understand why first method is not working - test this

    Please Login or Register  to view this content.
    Should get:

    Attachment 556802


    The only thing I can think of is that you have not declared your variables
    - try declaring I and P as integers
    Last edited by kev_; 01-18-2018 at 11:53 AM.

  8. #8
    Registered User
    Join Date
    01-18-2018
    Location
    North EAst, UK
    MS-Off Ver
    2013
    Posts
    5

    Re: Macro to increment a number up and print in reverse

    Hi kev_

    thanks for all the help - have managed to nail it.

    Regards Dino

  9. #9
    Forum Expert
    Join Date
    10-10-2016
    Location
    Sheffield
    MS-Off Ver
    365 and rarely 2016
    Posts
    3,212

    Re: Macro to increment a number up and print in reverse

    You should explain how you solved it for the benefit of others. Then it promotes learning

    it wasn't
    Range("C3").Value = Range("C3").Value + 1 the plus needing to change to a minus?

    regards

    Dav

  10. #10
    Registered User
    Join Date
    01-18-2018
    Location
    North EAst, UK
    MS-Off Ver
    2013
    Posts
    5

    Re: Macro to increment a number up and print in reverse

    Quote Originally Posted by davsth View Post
    You should explain how you solved it for the benefit of others. Then it promotes learning

    it wasn't
    Range("C3").Value = Range("C3").Value + 1 the plus needing to change to a minus?

    regards

    Dav
    Sorry

    This was the eventual macro used after a few trials

    Please Login or Register  to view this content.
    the macro opens a dialog box which asks for a number - eg 100
    if you have the number 00001 in cell C3 the number then jumps to 00100 then counts back and starts to print with 00001 being the last number printed the cell C3 once the countdown has finished then changes to 00100 ready for the next print run

  11. #11
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Macro to increment a number up and print in reverse

    Glad you got there - thanks for rep
    To mark thread as SOLVED, click Thread Tools (above post#1)

+ 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. Sequential Time Ticket Number Generator on Print won't increment
    By KG869 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-25-2015, 03:07 PM
  2. Macro to auto increment number
    By asianqueen in forum Excel General
    Replies: 2
    Last Post: 07-13-2015, 07:28 PM
  3. Replies: 8
    Last Post: 04-06-2015, 11:44 AM
  4. Excel Macro to increment invoice number by one
    By ginaleigh in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-18-2013, 12:25 AM
  5. [SOLVED] Macro to Increment and Print to PDF filename from merged cell
    By ahjualune in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-17-2012, 06:24 AM
  6. [SOLVED] Macro to Reverse Order of Columns but Dependent on Number of Data Rows
    By francois28 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-10-2012, 06:34 PM
  7. Replies: 3
    Last Post: 02-09-2011, 08:40 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