The code below is used to count the number of rows that contains data in column a:
Sub CountMyRows()
Dim RowCount As Integer
Range("a:a").Select
RowCount = (Selection.CurrentRegion.Rows.Count - 1)
'I added the '-1' so that it wouldn't count the
'header row in the RowCount
MsgBox (RowCount)
End Sub
The code below is used to count the number of columns that contains data in row 1:
Sub CountMyColumns()
Dim ColumnsCount As Integer
Range("1:1").Select
ColumnsCount = Selection.CurrentRegion.Columns.Count
MsgBox (ColumnsCount)
End Sub
No comments:
Post a Comment
Thanks for leaving a comment.