Hello,
I wonder if anyone can help me determine how I might be able to use VBA within excel to count the number of cells that contain data, in column E, start from row 17 to end. I have played with this using this code:
Sub rowcount
Dim ucount As Integer
Dim rCol As Integer
Dim Start_Row As Integer
Dim End_Row As Integer
ucount = 0
rCol = 5
For i = Start_Row To End_Row
Start_Row = 17
End_Row = Findlast(5)
If Cells(i, rCol) <> "" Then
ucount = ucount + 1
End If
Next i
msgbox "There are " & ucount " no blank cell"
End Sub
_______________________________________________________________________
Function Findlast(colnum)
endFlag = 0
Cells(65536, colnum).Select
If Trim(ActiveCell.Value) = "" Then
Selection.End(xlUp).Select
Findlast = ActiveCell.Row
End If
End Function
The Run-time error '1004': Application-defined or object-defined error. I don know what wrong with the code.
Much appreciate your help.
Thks & bst rgds, June
I wonder if anyone can help me determine how I might be able to use VBA within excel to count the number of cells that contain data, in column E, start from row 17 to end. I have played with this using this code:
Sub rowcount
Dim ucount As Integer
Dim rCol As Integer
Dim Start_Row As Integer
Dim End_Row As Integer
ucount = 0
rCol = 5
For i = Start_Row To End_Row
Start_Row = 17
End_Row = Findlast(5)
If Cells(i, rCol) <> "" Then
ucount = ucount + 1
End If
Next i
msgbox "There are " & ucount " no blank cell"
End Sub
_______________________________________________________________________
Function Findlast(colnum)
endFlag = 0
Cells(65536, colnum).Select
If Trim(ActiveCell.Value) = "" Then
Selection.End(xlUp).Select
Findlast = ActiveCell.Row
End If
End Function
The Run-time error '1004': Application-defined or object-defined error. I don know what wrong with the code.
Much appreciate your help.
Thks & bst rgds, June