是什么导致此 运行 次错误 13 "Type Mis-Match"?

What is causing this Run-time Error 13 "Type Mis-Match"?

下面的代码根据包含 "Yes" 的单元格递增一个变量。在我使用自动填充功能将 F13:F59 到 "Yes" 中的任何单元格的值设置之前,它一直有效。当我手动输入单词 "Yes" 时,不会出现 运行 时的错误。但是自动填充似乎是导致问题的原因。

Select Case (changedcell)
'Issues Mgmt
Case Range("F15"), Range("F19"), Range("F23"), Range("F27"), Range("F30"), Range("F39"), Range("F42"), Range("F45"), Range("F50"), Range("F53"), Range("F54") 'Issues
      If Range("F15").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F19").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F23").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F27").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F30").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F39").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F42").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F45").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F50").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F53").Value = "Yes" Then
        issues = issues + 1
      End If
      If Range("F54").Value = "Yes" Then
        issues = issues + 1
      End If

      If issues > 1 Then
    Application.EnableEvents = False
        MsgBox "Issues Management has already been selected under another old solution category.", vbCritical, "Duplicate Use Case Selected"
        Range(target.Address).Value = ""
     End If
End Select

代码的第一部分是发生错误的地方。有什么想法吗?

Case Range("F15"), Range("F19"), Range("F23"), Range("F27"), Range("F30"), Range("F39"), Range("F42"), Range("F45"), Range("F50"), Range("F53"), Range("F54") 'Issues

试试这个:

Dim rIssues As Range
Dim rCll As Range
    Set rIssues = Range("F15,F19,F23,F27,F30,F39,F42,F45,F50,F53,F54")
    For Each rCll In rIssues
        If rCll.Value = "Yes" Then Issues = 1 + Issues
    Next

    If Issues > 1 Then
        Application.EnableEvents = False
        MsgBox "Issues Management has already been selected under another old solution category.", _
            vbCritical, "Duplicate Use Case Selected"
        Range(Target.Address).Value = ""
     End If

建议阅读以下页面:

For Each...Next Statement,

Select Case Statement