为什么我的代码无法识别复选框?

时间:2020-08-17 16:12:59

标签: excel vba

我试图根据部分名称匹配和值遍历一个范围内的所有复选框,但是当我调试时,它看不到任何复选框并跳到最后。工作表中有100多个复选框。

Set breakRange = Range(Cells(i, 1), Cells(i, 30))
                
For Each checkbox In Worksheets("Data").CheckBoxes
    If Not Intersect(checkbox.TopLeftCell, breakRange) Is Nothing Then
        If checkbox.Name Like ("*" & "lunch" & "*") And checkbox.Value = True Then
            breaks = breaks + 0.5                            
        End If
        
        If checkbox.Name Like ("*" & "break" & "*") And checkbox.Value = True Then
            breaks = breaks + 0.25
        End If
    End If
Next

0 个答案:

没有答案