简体   繁体   English

Excel VBA多个复选框

[英]excel vba Multiple check boxes

I'm trying to collect the status of many Check Boxes in a User form and write X for check box that is in a False status Or V when it is in True status, but I always get the run time error when It gets to the line: 我正在尝试在用户表单中收集许多复选框的状态,并为处于False状态或V处于True状态的复选框写X,但是当它到达线:

For Each chk In UserForm1

Run-Time error '438': Object Doesn't support this property or method 运行时错误“ 438”:对象不支持此属性或方法

Here is what I have so far: 这是我到目前为止的内容:

    Private Sub CommandButton1_Click()
Dim ws As Worksheet
Dim Col As Long
Dim chk As Control
Set ws = Worksheets("Sheet1")
'find first empty row in database
iRow = ws.Cells(Rows.Count, 1) _
  .End(xlUp).Offset(1, 1).Row
Col = 1
MultiPage1.Value = 1
For Each chk In UserForm1
    If GroupName = Rooms Then
        If (chk.Value) = True Then
            ws.Cells(iRow, Col).Value = V
            Col = Col + 1
        End If
        Else
            ws.Cells(iRow, Col).Value = X
            Col = Col + 1
    End If
Next
End Sub

Any Suggestions? 有什么建议么?

Thanks in advance for any help or leads 预先感谢您的任何帮助或线索

在用户窗体的控件上指定循环。

For Each chk In UserForm1.Controls

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM