+ Reply to Thread
Results 1 to 16 of 16

Counting a set number of Rows

  1. #1
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Counting a set number of Rows

    Hi, if I had say " x = 53" could I then have a code which counted down to row "53"?

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

    Re: Counting a set number of Rows

    Hello Hurricanefly,

    You will have to provide more detais about what you want to do. Your post is very vague. It is rather like asking "Is it further to school or by bus?".
    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!)

  3. #3
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Counting a set number of Rows

    Hi, sorry about that! Basically I need to set a "Print Area" which only prints worksheets with data on them. The reason I ask about Row 53 is that it seems that there are 53 rows to print before a "New Page" is needed. The Print Area will always be in "B4:J53" (One Page) but there may be 600 rows on a worksheet or 53 on another? Very stuck, not sure if that helps?

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

    Re: Counting a set number of Rows

    Hello Hurricanefly,

    The Print Area is range of cells that you choose. If you have 1 to 53 rows then setting the print range to "B4:J53" will in fact print only 50 rows total. If your rows on the worksheet go past 53 then you will need a macro to group the remaining rows into separate print areas. This will produce 1 page for each new print area. Is this what you want to do?

  5. #5
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Counting a set number of Rows

    That is exactly what I would like to do. Is it difficult?

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

    Re: Counting a set number of Rows

    Hello Hurricanefly,

    No, it is fairly straight forward. Can you post a copy of your workbook? I can then review the data and code you have to create a macro.

    To Post Your Workbook
    1. At the bottom right of the Reply window, Click the button Go Advanced
    2. At the top of the Your Message Window, in the first row of icons, Click the Paperclip icon.
    3. Click the Add Files button at the top right in the dialog box. This displays the File Manager dialog.
    4. Click the Select Files button at the bottom middle of the dialog.
    5. In the new window Find the file you want to upload, select it, and Click Open.
    6. You will now be back in the File Manager dialog. Click the bottom Middle button Upload File.
    7. Wait until the file has completely uploaded before you exit the File Manager dialog.

    File Manger Picture

  7. #7
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Counting a set number of Rows

    Thank you.
    Attached Files Attached Files

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

    Re: Counting a set number of Rows

    Hello Hurricanefly,

    Thanks for the workbook. I have a question about Sheet2. It starts in column A and goes to I while all the other sheets use column s"B:J". Since it is 9 columns wide, it isn't a problem for the macro. I was curious if you will have other sheets like Sheet2.

  9. #9
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Counting a set number of Rows

    Sorry, I was mucking about with the original, and forgot to put column A back in. So no it will always be (B:J), sorry for the confusion.

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

    Re: Counting a set number of Rows

    Hello Hurricanefly,

    No problem.

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

    Re: Counting a set number of Rows

    Hello

    This macro will divide each worksheet into pages that are 50 rows by 9 columns and print the pages as it goes. After all the pages are printed for the worksheet, you will be asked if you want to continue to the next worksheet in the workbook.
    Please Login or Register  to view this content.

  12. #12
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Counting a set number of Rows

    Than you that is perfect I was going to put a "Msgbox" in too so you kinda read my mind. I was not even close, appreciate your help.

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

    Re: Counting a set number of Rows

    Hello Hurricanefly,

    'S e do bheatha!
    You're welcome.

  14. #14
    Forum Contributor
    Join Date
    05-09-2013
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    259

    Re: Counting a set number of Rows

    Hi, I just tried the code and got a "Run time error 438" on this line.
    Please Login or Register  to view this content.
    Any ideas?

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

    Re: Counting a set number of Rows

    Hello Hurricanefly,

    Which sheet?

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

    Re: Counting a set number of Rows

    Hello Hurricanefly,

    Never mind, I found it. That was my fault it was a typing error. Here is corrected and tested code...
    Please Login or Register  to view this content.

+ 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