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!!
Bookmarks