Count rows in excel vb

problem:

we want to count number of rows in excel with VB

solution:

I create the sub function to count the number of rows depend on where do you want to start!

Sub countRows()
RowCount = 0
RowNext = 22  ( please change the starting row according to your need)
Do While Cells(RowNext, 3).Value <> 0 ( the “3″ also need to be changed)
RowCount = RowCount + 1
RowNext = RowNext + 1
Loop
‘MsgBox RowCount
End Sub
This entry was posted in vb and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>