Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
dim r as range
for each r in selection.rows
...
next
Dim a As Range, areaCount, i
areaCount = Selection.Areas.Count
If areaCount <= 1 Then
MsgBox "The selection contains " & _
Selection.Rows.Count & " rows."
Else
i = 1
For Each a In Selection.Areas
MsgBox "Area " & i & " of the selection contains " & _
a.Rows.Count & " rows."
i = i + 1
Next a
End If
Sub test()
MsgBox CountSelectedRows(Selection)
End Sub
Function CountSelectedRows(ARange As Range) As Integer
Dim c As Range
Dim a(100) As Boolean
Dim i As Integer
For Each c In ARange
a(c.Row) = True
Next c
For i = LBound(a) To UBound(a)
If a(i) Then
CountSelectedRows = CountSelectedRows + 1
End If
Next i
End Function
Dim a As Range, areaCount, i
areaCount = Selection.Areas.Count
If areaCount <= 1 Then
MsgBox "The selection contains " & _
Selection.Rows.Count & " rows."
Else
i = 0
For Each a In Selection.Areas
i = i + 1
' MsgBox "Area " & i & " of the selection contains " & _
a.Rows.Count & " rows."
Next a
MsgBox i
End If