1

Is there a formula or method of keeping an exact amount of rows (i.e. 100 rows always) and counting inside said rows - regardless of inserts or deletes? I've tried absolute references, but the inserts and deletes affect it.

The only method that I have now is to rewrite the formulas after all the inserts and deletes have been completed.

Sub ExactRowsCount()
'
' ExactRowsCount Macro
'
Range("H1").Select
ActiveCell.FormulaR1C1 = "=COUNTA(R[4]C:R[104]C)"
Range("H2").Select

End Sub
Deafdan
  • 393
  • 2
  • 13

2 Answers2

3

I would use OFFSET:

=COUNTA(OFFSET(A1,4,0,100,1))

Where A1 is the cell where you want the count to end up. This formula may be particularly convenient if you want the column height to depend on another cell; for example, if you want to keep the column height in cell A2 instead of using a constant number 100, you could do:

=COUNTA(OFFSET(H1, 4, 0, A2, 1))
ikh
  • 2,336
  • 2
  • 19
  • 28
2

This will return the count of non-blank cells in A2 to A101 regardless of inserts and deletes:

=COUNTA(INDIRECT("A2:A101"))
Doug Glancy
  • 27,214
  • 6
  • 67
  • 115