| 
    
     |  | ▼β さん: 
 お返事いただき感謝いたします。
 不十分な説明、申し訳ないです。
 
 >1.ここでいう「活性」「非活性」の、mohimohi さんとしての定義を教えてください。
 ⇒「活性」:チェックボックス押下可
 「非活性」:チェックボックス押下不可
 という意味です。
 
 >2.チェックボックスを利用して、家族構成を活性、非活性として表したい
 ⇒チェックボックスは、8個あり、1.の定義によって絞り込まれた、該当のものを自動で、押下可、不可に表示したいのです。
 
 ht tp://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q12144985737
 上記の画像の表及びコンボボックス、チェックボックスをイメージしていただけるとありがたいです。
 
 また、現在作成中のコードを以下に貼ります。
 よろしくお願い致します。
 
 -----------
 
 'イメージ画にはありませんが、コマンドボタン1を押してから処理をスタート(クリア)するとします
 Private Sub CommandButton1_Click()
 
 Dim i As Integer
 Dim cellvalue As String
 
 i = 2
 
 ComboBox1.Clear
 Do
 cellvalue = Cells(i, 1).Value
 If cellvalue = "" Then
 Exit Do
 End If
 
 If FindItem(ComboBox1, cellvalue) = False Then
 ComboBox1.AddItem (cellvalue)
 End If
 
 i = i + 1
 Loop
 End Sub
 
 
 Private Sub ComboBox1_Change()
 
 Dim comboValue As String
 comboValue = ComboBox1.Value
 ComboBox2.Clear
 
 Dim i As Integer
 
 i = 2
 
 Do
 cellvalue = Cells(i, 2).Value
 If cellvalue = "" Then
 
 Exit Do
 End If
 
 If Cells(i, 1).Value = comboValue Then
 
 If FindItem(ComboBox2, cellvalue) = False Then
 ComboBox2.AddItem (cellvalue)
 End If
 
 End If
 i = i + 1
 
 Loop
 End Sub
 
 
 Private Sub ComboBox2_Change()
 
 
 Dim i As Integer
 Dim cellValue1 As String
 Dim cellValue2 As String
 Dim cellValue3 As String
 
 i = 2
 ComboBox3.Clear
 
 Dim comboValue1 As String
 Dim comboValue2 As String
 
 comboValue1 = ComboBox1.Value
 comboValue2 = ComboBox2.Value
 
 Do
 
 cellValue1 = Cells(i, 1).Value
 cellValue2 = Cells(i, 2).Value
 cellValue3 = Cells(i, 3).Value
 
 If cellValue1 = "" Then
 Exit Do
 End If
 
 If comboValue1 = cellValue1 And comboValue2 = cellValue2 Then
 
 If FindItem(ComboBox3, cellValue3) = False Then
 ComboBox3.AddItem (cellValue3)
 
 End If
 End If
 i = i + 1
 
 Loop
 End Sub
 
 
 Private Sub ComboBox3_Change()
 Dim i As Integer
 Dim cellValue1 As String
 Dim cellValue2 As String
 Dim cellValue3 As String
 Dim cellValue4 As String
 
 i = 2
 ComboBox4.Clear
 
 Dim comboValue1 As String
 Dim comboValue2 As String
 Dim comboValue3 As String
 
 comboValue1 = ComboBox1.Value
 comboValue2 = ComboBox2.Value
 comboValue3 = ComboBox3.Value
 
 Do
 
 cellValue1 = Cells(i, 1).Value
 cellValue2 = Cells(i, 2).Value
 cellValue3 = Cells(i, 3).Value
 cellValue4 = Cells(i, 4).Value
 
 If cellValue1 = "" Then
 Exit Do
 End If
 
 If comboValue2 = cellValue2 And comboValue3 = cellValue3 Then
 
 If FindItem(ComboBox4, cellValue4) = False Then
 ComboBox4.AddItem (cellValue4)
 
 End If
 End If
 i = i + 1
 
 Loop
 End Sub
 Private Sub ComboBox4_Change()
 Dim i As Integer
 Dim cellValue1 As String
 Dim cellValue2 As String
 Dim cellValue3 As String
 Dim cellValue4 As String
 Dim cellValue5 As String
 
 i = 2
 
 Dim comboValue1 As String
 Dim comboValue2 As String
 Dim comboValue3 As String
 Dim comboValue4 As String
 
 comboValue1 = ComboBox1.Value
 comboValue2 = ComboBox2.Value
 comboValue3 = ComboBox3.Value
 comboValue4 = ComboBox4.Value
 
 Do
 
 cellValue1 = Cells(i, 1).Value
 cellValue2 = Cells(i, 2).Value
 cellValue3 = Cells(i, 3).Value
 cellValue4 = Cells(i, 4).Value
 
 If cellValue1 = "" Then
 Exit Do
 End If
 
 If comboValue2 = cellValue2 And comboValue3 = cellValue3 Then
 
 If FindItem(ComboBox4, cellValue4) = False Then
 ComboBox4.AddItem (cellValue4)
 
 End If
 End If
 i = i + 1
 
 Loop
 End Sub
 
 
 Private Function FindItem(ByRef combo As ComboBox, ByVal item As String)
 Dim i As Integer
 
 For i = 0 To combo.ListCount - 1
 If combo.List(i) = item Then
 FindItem = True
 Exit Function
 End If
 
 Next
 FindItem = False
 End Function
 
 
 |  |