+ Reply to Thread
Results 1 to 5 of 5

Loop Counts Past # of Rows....WHY?

  1. #1
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Exclamation Loop Counts Past # of Rows....WHY?

    Hi,

    I have worksheet2 filtered down, and I copied the filtered data over to worksheet1. Below is the loop for counting the number of days from the date in column D, and placing the number in column E. It is functioning correctly, but it continues to try and count past the data set in column D. It is actually taking the total number of rows from worksheet2 before it was filtered, and that is how far the loop is executing in column E.

    Please assist me with the following question:

    How do I make the loop stop at the end of column D in worksheet1?


    Please Login or Register  to view this content.
    Thank you,

    Nick

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,521

    Re: Loop Counts Past # of Rows....WHY?

    Maybe:

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


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

    Re: Loop Counts Past # of Rows....WHY?

    Nick

    It might be as simple as a missing dot.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

  4. #4
    Forum Contributor
    Join Date
    09-06-2012
    Location
    New York
    MS-Off Ver
    Excel 2007
    Posts
    225

    Re: Loop Counts Past # of Rows....WHY?

    Thank you for the quick responses. That worked, but I dont understand how that made a difference? What is the difference between the .cells and Cells?

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,521

    Re: Loop Counts Past # of Rows....WHY?

    You've said:

    Please Login or Register  to view this content.

    The dots link the cells and rows.count to worksheet 1


    Regards, TMS

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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