VBA入門⑤ No.1 特定列の総データ件数を調べる
サンプル
- A列総データ件数を調べ、アラートで表示します
- 空白セルや数式はカウントされません
Option Explicit Sub myDcnt() Dim myYCnt As Integer myYCnt = Range("A1").EntireColumn.SpecialCells(xlCellTypeConstants).Count MsgBox "データ件数は" & myYCnt & "件です" End Sub
Option Explicit Sub myDcnt() Dim myYCnt As Integer myYCnt = Range("A1").EntireColumn.SpecialCells(xlCellTypeConstants).Count MsgBox "データ件数は" & myYCnt & "件です" End Sub