gpt4 book ai didi

excel - 在用户表单中编辑多个属性

转载 作者:行者123 更新时间:2023-12-04 20:16:33 25 4
gpt4 key购买 nike

我有一个带有 25 个选项按钮(OptionButton1、OptionButton2 等)的用户表单。我想用电子表格中的信息填充每个按钮的标题。我不确定完成这项工作的最佳代码。

For x = 1 to 25
OptionButton & x & .caption = range("a" & x)
Next x

显然这行不通,但这就是我想要它做的事情。有任何想法吗?

最佳答案

你可以这样做:

Private Sub UserForm_Initialize()
Dim x As Byte
'change Sheet1 to suit
With ThisWorkbook.Worksheets("Sheet1")
For x = 1 To 25
Me.Controls("OptionButton" & x).Caption = .Range("A" & x)
Next x
End With
End Sub

关于excel - 在用户表单中编辑多个属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22933464/

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