+ Reply to Thread
Results 1 to 4 of 4

LastRow = ActiveSheet.UsedRange.Rows.Count not givng correct value

  1. #1
    Registered User
    Join Date
    07-10-2012
    Location
    FL
    MS-Off Ver
    Excel 2007
    Posts
    17

    LastRow = ActiveSheet.UsedRange.Rows.Count not givng correct value

    The ojective of this routine is to determine if any employees are overdue in their salary review date. The routine first goes out to an Acess DB, and grabs the records where the salary consideration date is < Now(). If LastRow count is > 1 (title line) a msgbox is activated. LastRow value keeps coming up 16 even when I delete the rows below the title row. I am truly lost on this.

    Please Login or Register  to view this content.
    Last edited by Cutter; 08-24-2012 at 02:01 PM. Reason: Added code tags

  2. #2
    Forum Contributor wallyeye's Avatar
    Join Date
    05-06-2011
    Location
    Arizona
    MS-Off Ver
    Office 2010, 2007
    Posts
    308

    Re: LastRow = ActiveSheet.UsedRange.Rows.Count not givng correct value

    I use the .Find command, it is quite a bit more flexible:

    Please Login or Register  to view this content.
    I think the key part here is the LookIn:=xlvalues, with the UsedRange Excel has noted that you've used the range even though there is nothing in it. This version of .Find will look for any values, starting from the bottom (it wraps backwards from A1, because of the xlprevious) and return the row number of the first value it finds.

    BTW, you should put code tags around code in your post, simply select the code and click the # on the toolbar.

  3. #3
    Registered User
    Join Date
    07-10-2012
    Location
    FL
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: LastRow = ActiveSheet.UsedRange.Rows.Count not givng correct value

    Will try .Find. Alway open to a better way. Thanks. Will try to remember to the pound sign.

  4. #4
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: LastRow = ActiveSheet.UsedRange.Rows.Count not givng correct value

    @ BobBlooms

    Please notice that code tags have been added to your post(s). The forum rules require them so please keep that in mind and add them yourself whenever showing code in any of your future posts. To see instructions for applying them, click on the Forum Rules button at top of the page and read Rule #3.
    Thanks.

+ 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