[英]excel vba Multiple check boxes
我正在嘗試在用戶表單中收集許多復選框的狀態,並為處於False狀態或V處於True狀態的復選框寫X,但是當它到達線:
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
有什么建議么?
預先感謝您的任何幫助或線索
在用戶窗體的控件上指定循環。
For Each chk In UserForm1.Controls
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.