|
▼コロ さん:
クラスモジュールを使えばできそうですけど試してみますか?
★ユーザーフォームモジュール
Option Explicit
Dim ColCls As Collection
Private Sub UserForm_Initialize()
Dim ClsT As Class1
Dim i As Long
Set ColCls = New Collection
For i = 1 To 10
Set ClsT = New Class1
Call ClsT.propertysSet(Me("CheckBox" & i), Me("TextBox" & i))
ColCls.Add ClsT
Set ClsT = Nothing
Next i
End Sub
Private Sub UserForm_Terminate()
Set ColCls = Nothing
End Sub
★クラスモジュール(Class1)
Option Explicit
Private WithEvents Chk As MSForms.CheckBox
Private Txt As MSForms.TextBox
Sub propertysSet(ByVal ChkT As MSForms.CheckBox, ByVal TxtT As MSForms.TextBox)
Set Chk = ChkT
Set Txt = TxtT
End Sub
Private Sub Chk_Click()
If Chk Then
Txt.Value = 1
Else
Txt.Value = ""
End If
End Sub
という感じです。
違ったらすいません。
|
|