+ Reply to Thread
Results 1 to 5 of 5

Detect last row on last page

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    3

    Detect last row on last page

    Hello,

    I have been trying to figure out how to add borders to all the used pages, and not just the used cells or rows. I can easily detect the last used row by using something like this, but that’s not what I need:

    Please Login or Register  to view this content.
    I am having problems automatically locating the last row of the last used page. It is possible to locate each page break from something like this:

    Please Login or Register  to view this content.
    The problem is that I can’t find the last row from this, since there is no page break at that position. For example if there is only one page, there are no page breaks, but I still want to obtain the last row number. At the moment I have defined the last row number by assuming that the number of rows on each page always is the same and a predefined number, but I want it to be more flexible.

    Can anyone help me with this?

    Thanks in advance,

    /Kristine

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: Detect last row on last page

    Kristine

    Surely the last row of the last page is the last used row, so find that rather than the last page break.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    07-10-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Detect last row on last page

    With which piece of code would you then find this last used row? Because if i use this example:

    Please Login or Register  to view this content.
    Then it returns the last row with data and not the last row on the page if it is printed. I am not interested in putting borders around the data only, it has to be added to the whole page. I haven't been able to find a piece of code which does what i need, so i'd be thankful if you could give me an example.

    /Kristine

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644
    Can you attach a sample workbook?

  5. #5
    Registered User
    Join Date
    07-10-2013
    Location
    Denmark
    MS-Off Ver
    Excel 2010
    Posts
    3

    Re: Detect last row on last page

    Well as a very simple example i have attached something similar to what i wrote in my previous post. The two different ways of finding the last used row number used in the file will both return row 6, but i actually want to get row 50 returned even if the page was blank. I just want to know the last row present on the page no matter if there is data in it or not.

    /Kristine
    Attached Files Attached Files

+ 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