Method 1:


In this method  CountA function is used

Syntax:

WorksheetFunction.CountA(Range("ColumnRange")) + 1

Example:

MsgBox WorksheetFunction.CountA(Range("A:A")) + 1


Method 2:


In this method  xlUp is used

Syntax:

Range("A" & Rows.Count).End(xlUp).Row

Example:

    MsgBox Range("A" & Rows.Count).End(xlUp).Row


Method 3:


In this method  Cells and While loop  is used

Dim b As Integer
cnt = 1
While Cells(cnt, 1).Value <> ""
      b = b + 1
Wend
MsgBox b


Method 4:


In this method  Range and While loop  is used

Dim b As Integer
cnt = 1
While Range("A" & cnt).Value <> ""
  b = b + 1
Wend
MsgBox b


Post a Comment

Previous Post Next Post