For I = 1 To 7
Me.Controls("DayCheckBox" & I).value = True
Next
CheckBox Tag 方式
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeName(ctrl) = "CheckBox" Then
If ctrl.Tag = "Time" Then
MsgBox ctrl.Name & " = " & ctrl.value
End If
End If
Next
Set ctrl = Nothing
Reference :
Loop through checkboxes
Excel VBA: Loop Through Controls on a UserForm. Textbox, ComboBox, CheckBox etc
如何抓取動態產生的控制項(ex.textbox)
沒有留言:
張貼留言