| 
    
     |  | 職場の先輩にヒントを貰い、なんとかそれっぽい形が出来ましたが 指定した全ての文字列をうまくカウントしてくれませんでした。
 
 Const syori As String = "syori"           'syoriシートの定義づけ
 Dim R1 As Integer, C1 As Integer, i As Integer   'R1,C1,iの定義づけ
 Sub wk9()
 
 '(1)マクロ実行中に画面が動かないようにするおまじない
 Application.ScreenUpdating = False
 
 '(2)選択中のブックでシートを選択し、最終行列数を取得する
 Sheets(syori).Select
 Range("A1").Select
 With Sheets(syori).Cells(1, 1).CurrentRegion
 R1 = .Rows.Count
 C1 = .Columns.Count
 
 Mypos = 0
 ER_COUNT = 0
 For i = 2 To C1
 SerchString = .Cells(i, 3).Value
 
 Application.StatusBar = SerchString & "..."
 
 Mypos1 = InStr(SerchString, " ")       'スペースを探す
 Mypos2 = InStr(SerchString, "・")       '中黒を探す
 Mypos3 = InStr(SerchString, """")       '「”」を探す
 Mypos4 = InStr(SerchString, "'")       '「’」を探す
 Mypos = Mypos1 + Mypos2 + Mypos3 + Mypos4  '検知した禁則文字を全て足し算
 If Mypos <> 0 Then              '##0以外だったら(検出されたら)エラー
 ER_COUNT = ER_COUNT + 1
 
 Cells(i, 3).Interior.ColorIndex = 6
 End If
 Next
 
 End With
 
 MsgBox ER_COUNT & "件"
 
 End Sub
 
 宜しければ見ていただけませんでしょうか?
 
 |  |