Ads by Google

Monday, January 5, 2009

Row Counter for Excel

I always wondered if there is a way to count the number of rows that contains information leaving blanks. I was able to do it with following code:

Assume that your data starts from Cell A6. Run the following code:

Sub rowCount()

Range("A6").Select

rowcounter = 6

ActiveCell.Offset(1, 0).Select

Do Until ActiveCell = ""

rowcounter = rowcounter + 1

ActiveCell.Offset(1, 0).Select

Loop

MsgBox ("There are " & rowcounter & " number of rows")

End Sub

Hope this will help