+ Reply to Thread
Results 1 to 5 of 5

Why is this not getting the last row of the first/fixed column?

  1. #1
    Registered User
    Join Date
    11-06-2012
    Location
    ndemene
    MS-Off Ver
    Excel 2010
    Posts
    74

    Why is this not getting the last row of the first/fixed column?

    Here is the current macro I am working with.:
    Please Login or Register  to view this content.
    I am trying to get the last row of the first column without typing the number manually. My commented attempts above all failed. I remember one (or more) of the attempts kept giving me the 38th row which is not the last one and there is no empty cell in the middle or anything like that so I don't know why this happens. I intend to use a loop to copy many rows and the number will keep growing and I don't want the code to stop working if a row is added.

    Could someone please help me get the currentRow variable to hold the bottom-most row without typing the numerical value in manually?

    Any help would be greatly appreciated!

  2. #2
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Why is this not getting the last row of the first/fixed column?

    These three methods should work if you include a reference to the worksheet ws.

    Please Login or Register  to view this content.
    The xlCellTypeLastCell method isn't 100% reliable in some situations. If you deleted the last used cell(s), it doesn't update until you resave.

  3. #3
    Registered User
    Join Date
    11-06-2012
    Location
    ndemene
    MS-Off Ver
    Excel 2010
    Posts
    74

    Re: Why is this not getting the last row of the first/fixed column?

    Thanks for your answer. How do I include a reference to the ws worksheet?

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,653

    Re: Why is this not getting the last row of the first/fixed column?

    I had included it.

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-06-2012
    Location
    ndemene
    MS-Off Ver
    Excel 2010
    Posts
    74

    Re: Why is this not getting the last row of the first/fixed column?

    Oops! Okay so, you said the first one is less reliable so, out of the last two, which one is faster? It seems to me that the second one searches from the end and that the third one searches from the beginning and given that all the data I want is at the end, the second one should be faster. Am I correct?

+ 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