Private Sub CmdTim_Click()
Dim StrC As String: Dim Arr()
Dim Rws As Long, J As Long, W As Integer, Col As Byte, DD As Byte '1'
With Sheets("CSDL")
Arr() = .[b2].CurrentRegion.Offset(1).Value
ReDim dArr(1 To 99, 1 To 3)
.[aa2].Resize(99, 3).Value = dArr()
End With
If Left(Me!cbHT.Text, 1) = "T" Then
StrC = " " & Me!tbHT.Text
ElseIf Left(Me!cbHT.Text, 1) = "H" Then
StrC = Me!tbHT.Text & " "
End If
DD = Len(StrC) '5'
For J = 1 To UBound(Arr())
9 If (Left(Me!cbHT.Text, 1) = "T" And Right(Arr(J, 2), DD) = StrC) Or _
(Left(Me!cbHT.Text, 1) = "H" And Left(Arr(J, 2), DD) = StrC) Then
W = W + 1
For Col = 1 To 3
dArr(W, Col) = Arr(J, Col)
Next Col
End If
Next J
If W Then
Sheets("CSDL").[aa2].Resize(W, 3).Value = dArr()
Else
MsgBox "Nothing"
End If
End Sub