|
サンプルを載せておきますので、参考にして下さい。
Private Sub ComboBox1_Change()
Dim r As Range
ComboBox2.Clear
With Worksheets("Sheet1")
.AutoFilterMode = False
.Columns("A:D").AutoFilter Field:=3, Criteria1:=ComboBox1.Value
For Each r In .Range("D2:D" & .Range("D65536").End(xlUp).Row). _
SpecialCells(xlCellTypeVisible)
ComboBox2.AddItem r.Value
Next r
.AutoFilterMode = False
End With
End Sub
Private Sub UserForm_Initialize()
Dim i As Long
With Worksheets("Sheet1")
For i = 2 To .Range("A65536").End(xlUp).Row
ComboBox1.AddItem .Cells(i, 3).Value
ComboBox2.AddItem .Cells(i, 4).Value
Next i
End With
End Sub
|
|