Home > 即効テクニック > Excel VBA > その他関連のテクニック > フィルタで抽出したデータの数をカウントする

即効テクニック

その他関連のテクニック

フィルタで抽出したデータの数をカウントする

(Excel 97/2000)
サンプルマクロは、フィルタで抽出したデータ数をメッセージボックスで表示します。
Sub Sample()

    MsgBox Range(Range("A2"), _
        Cells(Rows.Count, 1).End(xlUp)) _
        .SpecialCells(xlCellTypeVisible).Count
        'Excel95ではxlCellTypeVisibleに替えてxlVisibleを使用

End Sub