Run-time error '-2147352567 (80020009)' The index into the specified collection is out of bounds

假装没事ソ 提交于 2020-01-24 12:25:13

问题


I am running periodically into an error: Run-time error '-2147352567 (80020009)' The index into the specified collection is out of bounds.

This error is thrown on the line

For Each cb In wks.Shapes

Here is the full code:

Sub SelectAll(wks As Worksheet)
Application.ScreenUpdating = False
Dim cb As Shape

'Loop through Checkboxes
  For Each cb In wks.Shapes
    If cb.Type = msoFormControl Then
      If cb.FormControlType = xlCheckBox Then
        cb.OLEFormat.Object.Value = xlOn
        With cb.OLEFormat.Object
            Application.Run .OnAction, .Name
        End With
      End If
    End If
  Next cb
Application.ScreenUpdating = True
End Sub

来源:https://stackoverflow.com/questions/44912369/run-time-error-2147352567-80020009-the-index-into-the-specified-collection

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!