Hi.
I had to change so now is the way I need.
Private Sub TextBox1_LostFocus()
FilterNow
End Sub
Private Sub TextBox1_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
If KeyCode = Asc(vbCr) Then
FilterNow
End If
End Sub
Private Sub FilterNow()
If Trim(TextBox1.Value) > vbNullString Then
Range("A1").CurrentRegion.AutoFilter Field:=4, Criteria1:=TextBox1.Value
ElseIf ActiveSheet.AutoFilterMode Then
Range("A1").CurrentRegion.AutoFilter
Else: Range("A1").Select
End If
End Sub
Sub TestFilter()
Application.DisplayAlerts = False
Range("A2:Q" & Cells(Rows.Count, 1).End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy Destination:=Sheets("Plan1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Range("A2:Q" & Cells(Rows.Count, 1).End(xlUp).Row).SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAlerts = True
End Sub
How do I put a msgbox if the users decide not enviaar the data to another tab?
See what I tried but it did not work!
Sub TestFilter()
Dim iRet As Integer
MsgBox "Favor conferir o número da ordem!" & "-" & Me.TextBox1.Value, vbOKCancel, "Atenção...!"
If iRet = OK Then
Application.DisplayAlerts = False
Range("A2:Q" & Cells(Rows.Count, 1).End(xlUp).Row).SpecialCells(xlCellTypeVisible).Copy Destination:=Sheets("Plan1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
Range("A2:Q" & Cells(Rows.Count, 1).End(xlUp).Row).SpecialCells(xlCellTypeVisible).Delete
Application.DisplayAlerts = True
Else
Exit Sub
End If
End Sub
Thank you!!
Bookmarks