删除选中的Activexcheckbox

我试图写一个macros,将删除选定范围内的所有ActiveXxcheckbox。 我写了这段代码,但是它一直返回“Object不支持这个属性或方法”的错误。 请帮忙。

Dim cbx As OLEObject Dim rng As Range Set rng = selection For Each cbx In ActiveSheet.OLEObjects If Not Intersect(rng, cbx.Object.TopLeftCell) Is Nothing Then cbx.Delete Next 

 If Not Intersect(rng, cbx.TopLeftCell) Is Nothing Then cbx.Delete 

这将删除select内的所有ActiveXcheckbox:

 Sub DeleteActiveXCheckboxes() Dim Shape As Shape For Each Shape In ActiveSheet.Shapes If Shape.Type = 12 Then If Not Intersect(Shape.TopLeftCell, Selection) Is Nothing Then Shape.Delete End If End If Next Shape End Sub