Here is a revision:
Option Explicit
Dim Data As Range
Dim LowestLevel As Long
Private Sub ComboBox1_click()
Dim rng As Range, cell As Range
Dim res As Variant
Dim varr() As String
Dim icnt As Long
Dim bFirst As Boolean
ReDim varr(1 To 50)
If ComboBox1.ListIndex <> -1 Then
If LowestLevel > 1 Then
Data.Parent.ShowAllData
End If
Worksheets("Sheet3").AutoFilter.Range _
.AutoFilter Field:=1, _
Criteria1:=ComboBox1.Value
LowestLevel = 2
ComboBox2.Clear
ComboBox3.Clear
On Error Resume Next
Set rng = Data.Columns(2).SpecialCells(xlVisible)
On Error GoTo 0
bFirst = True
If rng Is Nothing Then
ComboBox2.Clear
ComboBox3.Clear
Exit Sub
End If
For Each cell In rng
If bFirst Then
ComboBox2.AddItem cell.Value
icnt = 1
varr(icnt) = cell.Value
bFirst = False
Else
res = Application.Match(cell.Value, varr, 0)
If IsError(res) Then
icnt = icnt + 1
varr(icnt) = cell.Value
ComboBox2.AddItem cell.Value
If icnt = UBound(varr) Then _
ReDim Preserve varr(1 To UBound(varr) + 50)
End If
End If
Next
Else
ComboBox2.Clear
ComboBox2.ListIndex = -1
End If
End Sub
Private Sub ComboBox2_click()
Dim rng As Range, cell As Range
Dim varr() As String
Dim res As Variant
Dim bFirst As Boolean
Dim icnt As Long
ReDim varr(1 To 50)
If ComboBox1.ListIndex <> -1 And _
ComboBox2.ListIndex <> -1 Then
If LowestLevel > 2 Then
Data.Parent.ShowAllData
Worksheets("Sheet3").AutoFilter.Range _
.AutoFilter Field:=1, _
Criteria1:=ComboBox1.Value
End If
Worksheets("Sheet3").AutoFilter.Range _
.AutoFilter Field:=2, _
Criteria1:=ComboBox2.Value
LowestLevel = 3
ComboBox3.Clear
On Error Resume Next
Set rng = Data.Columns(3).SpecialCells(xlVisible)
On Error GoTo 0
If rng Is Nothing Then
ComboBox3.Clear
Exit Sub
End If
bFirst = True
For Each cell In rng
If bFirst Then
ComboBox3.AddItem cell.Value
icnt = 1
varr(icnt) = cell.Value
bFirst = False
Else
res = Application.Match(cell.Value, varr, 0)
If IsError(res) Then
icnt = icnt + 1
varr(icnt) = cell.Value
ComboBox3.AddItem cell.Value
If icnt = UBound(varr) Then _
ReDim Preserve varr(1 To UBound(varr) + 50)
End If
End If
Next
Else
ComboBox3.Clear
ComboBox3.ListIndex = -1
End If
End Sub
Private Sub ComboBox3_click()
If ComboBox1.ListIndex <> -1 And _
ComboBox2.ListIndex <> -1 And _
ComboBox3.ListIndex <> -1 Then
If LowestLevel > 2 Then
Data.Parent.ShowAllData
Worksheets("Sheet3").AutoFilter.Range _
.AutoFilter Field:=1, _
Criteria1:=ComboBox1.Value
Worksheets("Sheet3").AutoFilter.Range _
.AutoFilter Field:=2, _
Criteria1:=ComboBox2.Value
End If
Worksheets("Sheet3").AutoFilter.Range _
.AutoFilter Field:=3, _
Criteria1:=ComboBox3.Value
LowestLevel = 3
Else
ComboBox3.Clear
ComboBox3.ListIndex = -1
End If
End Sub
Private Sub UserForm_Initialize()
Dim rng As Range
With Worksheets("Sheet3a")
Set rng = .Cells(1, 1).CurrentRegion.Columns(1)
Set rng = rng.Offset(1, 0).Resize(rng.Rows.Count - 1)
End With
ComboBox1.RowSource = rng.Address(external:=True)
With Worksheets("Sheet3")
Set rng = .Cells(1, 1).CurrentRegion
If Not .AutoFilterMode Then
rng.AutoFilter
Else
If .FilterMode Then
.ShowAllData
End If
End If
Set Data = .AutoFilter.Range
Set Data = Data.Offset(1, 0).Resize( _
Data.Rows.Count - 1)
End With
End Sub