title: How to  count number of rows and make it as a condition when VBA inserts rows in between?
body: <p>I Need to use a loop in my code and at a certain condition I will insert row.</p>
  
  <pre><code>Rowz = activesheet.Cells(Rows.Count, 1).End(xlUp).Row
  for j=3 to Rowz ' say number of rowz=1000
  </code></pre>
  
  <p>But as rows are inserted in between So the number of rows are increased. Say for example at the 200th row I insert 4 rows and 500th row I insert 10 rows So the number is increased to more than 1000 now so the loop tests till 1000 ignoring the remaining rows which are pushed down due to inserting. But I need to perform that loop till the last row even rows are inserted in between </p>
  
  <p>I thought to use these </p>
  
  <pre><code>  for j=3 to activesheet.cells(Rows.count,1).End(xlUp).Row
  </code></pre>
  
  <p>But the value is not updating  i Guess its just checking upto 1000 only its not updating the number of rows value in the to condtion.</p>
  
  <p>How do I count number of rows and keep it in a condition if rows are created in between?   </p>