【发布时间】:2016-06-25 10:32:01
【问题描述】:
我正在尝试在用户表单中收集许多复选框的状态,并为处于 False 状态的复选框写 X 或在其处于 True 状态时写 V, 但是当它到达该行时,我总是会遇到运行时错误:
For Each chk In UserForm1
运行时错误“438”:对象不支持此属性或方法
这是我目前所拥有的:
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
有什么建议吗?
提前感谢您的任何帮助或线索
【问题讨论】: