Count number of cells in a range
Macro Title:
|
Worksheet Variable:
|
Worksheet Name:
|
Range Reference:
|
Output Cell:
|
First Comment:
' |
Second Comment:
' |
Sub Count_number_of_cells_in_range()
'declare a variable
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'count the total number of cells in a specific range
ws.Range("B5") = ws.Range("E5:K10").Rows.Count * ws.Range("E5:K10").Columns.Count
End Sub
Sub Count_number_of_cells_in_range()
'declare a variable
Dim ws As Worksheet
Dim ws As Worksheet
Set ws = Worksheets("Analysis")
'count the total number of cells in a specific range
ws.Range("B5") = ws.Range("E5:K10").Rows.Count * ws.Range("E5:K10").Columns.Count
ws.Range("B5") = ws.Range("E5:K10").Rows.Count * ws.Range("E5:K10").Columns.Count
End Sub