Dec 10, 2008

memo of MS.Excel.VBA V

Purpose
  Count used cells in excel excluding the blank ones

Function RowCount() as long
dim i
dim bEnd as Boolean
dim strCell

i=0
Do while(Not bEnd)
      strCell=ActiveSheet.cells(i,1)
      if trim(strCell)="" then
            bEnd=True
      Else
            i=i+1
      End If
Loop
RowCount=i

End Function

No comments: