Option Explicit
Dim id_line As Integer ' 加工ライン名のシート
Dim id_section As Integer ' メンテナス項目のシート
Dim id_koukan As Integer '交換ヶ所のシート
Dim id_subsection1 As Integer '交換部品その①のシート
Dim id_subsection2 As Integer '交換部品その②のシート
Private Sub CategoryArea_Click()
End Sub
Private Sub cbo_Kakoumei_Change()
Dim Fila As Integer
Dim Final As Integer
cbo_Section.Clear
With Sheet2 ' メンテナス項目のシート
id_line = cbo_Kakoumei.ListIndex + 1
Final = .Cells(1, 1).End(xlDown).Row
For Fila = 2 To Final
If Mid(.Cells(Fila, 1), 1, 1) = id_line Then
cbo_Section.AddItem (.Cells(Fila, 2))
End If
Next
End With
End Sub
Private Sub cbo_Section_Change()
Dim Fila As Integer
Dim Final As Integer
cbo_KoukanKasho.Clear
With Sheet3 ' 交換ヶ所のシート
id_section = cbo_Section.ListIndex + 1
Final = .Cells(1, 1).End(xlDown).Row
For Fila = 2 To Final
If Mid(.Cells(Fila, 1), 1, 1) = id_line And _
Mid(.Cells(Fila, 1), 2, 2) = id_section Then
cbo_KoukanKasho.AddItem (.Cells(Fila, 2))
End If
Next
End With
End Sub
Private Sub cbo_KoukanKasho_Change()
Dim Fila As Integer
Dim Final As Integer
cbo_Koukanbuhin1.Clear
With Sheet4 '交換部品その①のシート
id_koukan = cbo_KoukanKasho.ListIndex + 1
Final = .Cells(1, 1).End(xlDown).Row
For Fila = 1 To Final
If Mid(.Cells(Fila, 1), 1, 1) = id_line And _
Mid(.Cells(Fila, 1), 2, 2) = id_section And _
Mid(.Cells(Fila, 1), 3, 1) = id_koukan Then
cbo_Koukanbuhin1.AddItem (.Cells(Fila, 2))
End If
Next
End With
End Sub
Private Sub cbo_Koukanbuhin1_Change()
Dim Fila As Integer
Dim Final As Integer
cbo_Koukanbuhin2.Clear
With Sheet5 '交換部品その②のシート
id_subsection1 = cbo_Koukanbuhin1.ListIndex + 1
Final = .Cells(1, 1).End(xlDown).Row
For Fila = 2 To Final
If Mid(.Cells(Fila, 1), 1, 1) = id_line And _
Mid(.Cells(Fila, 1), 2, 2) = id_section And _
Mid(.Cells(Fila, 1), 3, 1) = id_koukan And _
Mid(.Cells(Fila, 1), 4, 1) = id_subsection1 Then
cbo_Koukanbuhin2.AddItem (.Cells(Fila, 2))
End If
Next
End With
End Sub
Private Sub cbo_Koukanbuhin2_Change()
Dim Fila As Integer
Dim Final As Integer
With Sheet5 '交換部品その②のシート
id_subsection2 = cbo_Koukanbuhin2.ListIndex + 1
Final = .Cells(1, 1).End(xlDown).Row
For Fila = 2 To Final
If Mid(.Cells(Fila, 1), 1, 1) = id_line And _
Mid(.Cells(Fila, 1), 2, 2) = id_section And _
Mid(.Cells(Fila, 1), 3, 1) = id_koukan And _
Mid(.Cells(Fila, 1), 4, 1) = id_subsection1 And _
Mid(.Cells(Fila, 1), 5, 1) = id_subsection2 Then
End If
Next
End With
End Sub
Private Sub UserForm_Initialize()
Dim Fila As Integer
Dim Final As Integer
With Sheet1 '加工ライン名
Final = .Cells(1, 1).End(xlDown).Row
For Fila = 2 To Final
If .Cells(Fila, 1) <> "" Then
cbo_Kakoumei.AddItem (.Cells(Fila, 2))
End If
Next
End With
End Sub
Private Sub CommandButton1_Click()
Unload Me
End Sub
Bookmarks