Private Sub myCntN()
Dim myRange As Range
Dim mySt
Dim myCount
Dim X
mySt = "単語帳A" 'シート名
myCount = 0
X = TextBox1.Text '検索する文字列
Set myRange = Worksheets(mySt).Range("H101:H65536")
If OptionButton1.Value = True Then
myCount = Application.WorksheetFunction.CountIf(myRange, "=" & X) '完全一致
Else
myCount = Application.WorksheetFunction.CountIf(myRange, "=" & "*" & X & "*") 'あいまい
End If
Label2.Caption = myCount '件数を表示
End Sub
|