gpt4 book ai didi

excel - 无法选择组合框

转载 作者:行者123 更新时间:2023-12-02 20:37:27 25 4
gpt4 key购买 nike

我有一个名为“Facility”的组合框,已作为表单控件添加到 Excel 2010 工作表中。我还有一个名为“AdjustmentsAmount”的模块,它在单击表单按钮时运行以下方法。我尝试了几种访问表单控件的方法,但都不起作用,如下所示。有人可以阐明这个主题吗?

代码

'Clears all run specifications
Sub clearRunSpecs_click()
Dim resp As String
resp = MsgBox("This will clear all run specifications. Are you sure you want to continue?", vbYesNo)
If (resp = vbYes) Then
Worksheets("AdjustmentsAmount").Unprotect "pass"
Range("D3").Clear
Range("D3").Interior.Color = RGB(235, 241, 222)
Range("D3").BorderAround LineStyle:=XlLineStyle.xlContinuous, Weight:=xlMedium, ColorIndex:=xlColorIndexAutomatic, Color:=RGB(0, 0, 0)
Range("D3").Locked = False
Range("D4").Clear
Range("D4").Interior.Color = RGB(235, 241, 222)
Range("D4").BorderAround LineStyle:=XlLineStyle.xlContinuous, Weight:=xlMedium, ColorIndex:=xlColorIndexAutomatic, Color:=RGB(0, 0, 0)
Range("D4").Locked = False
Range("B4").Clear
Range("B4").Interior.Color = RGB(235, 241, 222)
Range("B4").BorderAround LineStyle:=XlLineStyle.xlContinuous, Weight:=xlMedium, ColorIndex:=xlColorIndexAutomatic, Color:=RGB(0, 0, 0)
Range("B4").Locked = False
Range("A17:D22").Clear
Range("A17:D22").Merge
Range("A17:D22").Interior.Color = RGB(235, 241, 222)
Range("A17:D22").BorderAround LineStyle:=XlLineStyle.xlContinuous, Weight:=xlMedium, ColorIndex:=xlColorIndexAutomatic, Color:=RGB(0, 0, 0)
Range("A17:D22").VerticalAlignment = xlTop
Range("A17:D22").Locked = False
ActiveSheet.Shapes("Facility").ListIndex = -1
ActiveSheet.CheckBoxes("ZeroBalance").Value = xlOff
ActiveSheet.CheckBoxes("Balance<Adj").Value = xlOff
ActiveSheet.CheckBoxes("Balance=Adj").Value = xlOff
Worksheets("AdjustmentsAmount").Protect "pass"
End If
End Sub

尝试过的方法

ActiveSheet.Shapes("Facility")
ActiveSheet.Facility
ActiveSheet.ListBoxes("Facility")
Application.Facility

我使用ActiveSheet.CheckBoxes("NAME")以相同的方法访问了复选框,效果很好。但是,我似乎无法掌握组合框。

最佳答案

我已将一个空行设置为 ListIndex1 并使用:

ActiveSheet.Shapes("Facility").ControlFormat.ListIndex = 1

访问它。我想这就是您所需要的?

关于excel - 无法选择组合框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15499706/

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