+ Reply to Thread
Results 1 to 1 of 1

LastRow - for next loops longer than lastrow?

  1. #1
    Registered User
    Join Date
    05-22-2014
    Posts
    37

    LastRow - for next loops longer than lastrow?

    Hi.
    I have a macro that does calculations. The basis is from I9 to "I"&LastRow (this varies, see further down the post). Results are shown in Range("F" & i).
    When I determin the LastRow I use;
    LastRow = rs.Range("I" & rs.Rows.Count).End(xlUp).Row
    rs is the defined sheet.

    I have numbers in I9 to I97 (LastRow). I use the for i=9 to i=LastRow loop.
    This works great.
    THEN I remove/delete (tried both) the rows for I97 to I73.
    When I try to calculate, the results still shows all the way down to F97.

    The strange thing is that if I (at the end of the sub) writes rs.range("B1")=LastRow the number is correct (that is 73).... so this seemes to work (I have read something about UsedRange, but this does not seems to be the problem, or?)
    I have treid to write several if-sentences to stop the "for" or "sub", but nothing works...?
    f.ex; If Not IsNumeric(rs.Range("I" & i)) = True Then Exit For


    So, all I want, is the loop to stop at 73.

    Edit:It works, the reason I didn't see it, was because I had another macro to delete the range, and that macro did not delete the lines from 73 to 97, so when I scrolled down after using the delete macro, I saw it...

    Sorry for bothering you guys!!
    Last edited by flabb; 01-07-2016 at 04:40 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Find the LastRow
    By SIMBAtheCAT in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-22-2014, 11:45 AM
  2. Copy From LastRow to LastRow+7
    By dvent in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-11-2010, 06:56 AM
  3. lastrow of 3 columns
    By Directlinq in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-19-2009, 10:35 AM
  4. Dim Lastrow ? Dim LastColumn
    By khalid79m in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2008, 01:43 PM
  5. Autofill to lastrow
    By Pedros in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-11-2007, 12:55 AM
  6. LastRow function - #VALUE
    By slc in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-01-2005, 05:05 PM
  7. LastRow format
    By Ken Scanlon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-27-2005, 02:21 PM

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