gpt4 book ai didi

excel - 使用VBA获取Excel中所有复选框的值

转载 作者:行者123 更新时间:2023-12-02 07:29:46 25 4
gpt4 key购买 nike

我使用以下代码以编程方式向 Excel 工作表添加许多复选框:

With ActiveSheet.CheckBoxes.Add(rCell.Left, rCell.Top, rCell.Width, rCell.Height)
.Interior.ColorIndex = xlNone
.Caption = ""
End With

现在我需要一个代码来解析工作表中存在的所有复选框并获取它们的值(true 或 false)以及它们所在的单元格。如何做到这一点?

谢谢...

最佳答案

Sub Add_CheckBoxes()

With ActiveSheet.CheckBoxes.Add(ActiveCell.Left, ActiveCell.Top, ActiveCell.Width, ActiveCell.Height)
.Interior.ColorIndex = xlNone
.Caption = ""
End With

For Each chk In ActiveSheet.CheckBoxes
If chk Then MsgBox "Checked"
Next
End Sub

关于excel - 使用VBA获取Excel中所有复选框的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1409744/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com