【问题标题】:macro to delete activex checkbox in the selected range删除所选范围内的 activex 复选框的宏
【发布时间】:2013-06-07 01:59:57
【问题描述】:

我正在尝试使用以下代码删除“ActiveX”复选框。但是,它不起作用。请多多指教。

Sub CheckboxRemove()
    Dim cl As Range
    Dim cb As Object

    For Each cl In Selection
        Set cb = ActiveSheet.CheckBoxes.Delete()
    Next cl

    Set cl = Nothing
    Set cb = Nothing
End Sub

例如,我已将这些 ActiveX 复选框从 A1 放置到 F1 单元格范围。我将从 A1:F1 中选择单元格,当我运行此宏时,应删除这些复选框。请指教

【问题讨论】:

标签: vba excel


【解决方案1】:

将复选框视为形状,然后检查左上角单元格的位置:

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-10-15
    • 1970-01-01
    • 2011-03-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-12
    • 1970-01-01
    相关资源
    最近更新 更多