+ Reply to Thread
Results 1 to 8 of 8

Keep printing until all values in a column is printed out - Macro

  1. #1
    Registered User
    Join Date
    04-05-2012
    Location
    Canada
    MS-Off Ver
    Excel 2003/2007
    Posts
    45

    Keep printing until all values in a column is printed out - Macro

    Hi. I have a scenario that I would like to accomplish but need help from people who know a lot of Macro or VBA.


    Sheet1:
    A1:A300 (not consistent)
    1 - I would like to have a macro that will copy 10 cells at a time from Sheet1 to Sheet2 (A1:B10)
    2 - Then once transferred, Sheet2 is automatically printed
    3 - Then once printed, copy the other 10 cells (this time it would be A11:A20 to Sheet2 (A1:B10)
    4 - repeat step 1 to 3 until everything is printed out. Now as mentioned above, A1:A300 is not consistent, it could be A1:A20 or A1:A799, etc.

    Summary: I would like to print all info in Sheet1 using the format in Sheet2 - that is 10 values at a time. Thank you.

  2. #2
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Keep printing until all values in a column is printed out - Macro

    Try this:
    Change Sheet2 with the the name of the second sheet.

    Please Login or Register  to view this content.
    Regards,
    Khaled Elshaer
    www.BIMcentre.com

    Remember To Do the Following....
    1. Thank those who have helped you by clicking the Star below their post.
    2. Mark your post SOLVED if it has been answered satisfactorily:
    • Select Thread Tools (on top of your 1st post)
    • Select Mark this thread as Solved

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Keep printing until all values in a column is printed out - Macro

    Hello itsmejan24,

    Welcome to the Forum!

    The macro below will automatically find the end of column "A" on "Sheet1". The contents of these cells will be copied into cell "A1:B10" on "Sheet2", printed out and then repeated until there is no more. Data

    You can change the worksheet names from "Sheet1" and "Sheet2" to what you are actually using. Not sure if the cell addresses on "Sheet2" were a typo but "A1:B10" is twenty cells, not ten.

    Add a new VBA module to your workbook then copy and paste the code below into it.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    04-05-2012
    Location
    Canada
    MS-Off Ver
    Excel 2003/2007
    Posts
    45

    Re: Keep printing until all values in a column is printed out - Macro

    Leith Ross and Kelshaer .....It worked perfectly!!! Thank you very much for your help. I really appreciated it.

  5. #5
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Keep printing until all values in a column is printed out - Macro

    Please mark the thread as solved

  6. #6
    Registered User
    Join Date
    04-05-2012
    Location
    Canada
    MS-Off Ver
    Excel 2003/2007
    Posts
    45

    Re: Keep printing until all values in a column is printed out - Macro

    Hi. Sheet2 now is printing okay - A1:B10 info are all printed perfectly. I would like to ask another favor. Is it possible to put an empty cell in between the row. Let say, when it copies the info on A1 and B1, A2 and B2 should be empty and the next info should be copied into A3 and B3 and so on....

    Thank you again in advance.

  7. #7
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Keep printing until all values in a column is printed out - Macro

    Hello itsmejan24,

    Here is the update to add a blank between the lines on "Sheet2". The added change is in bold.
    Please Login or Register  to view this content.

  8. #8
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Keep printing until all values in a column is printed out - Macro

    Try this
    Please Login or Register  to view this content.
    Last edited by Kelshaer; 04-10-2012 at 01:16 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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