Hi zipperzipped1204
Try this...
Option Explicit
Sub Filter1()
Dim ws As Worksheet
Dim Rng As Range
Dim LR As Long
Dim x As Long
Dim Accno As Long
On Error Resume Next
Application.DisplayAlerts = False
Accno = Application.InputBox("Enter Account number", Type:=1)
Application.DisplayAlerts = True
On Error GoTo 0
If Accno = 0 Then
Exit Sub
Else
Set ws = Sheets("Sheet2")
With ws
LR = .Cells.Find("*", .Cells(.Rows.Count, .Columns.Count), SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
ActiveSheet.Range("A1:E" & LR).AutoFilter Field:=1, Criteria1:=Accno
Set Rng = .AutoFilter.Range
x = Rng.Columns(1).SpecialCells(xlCellTypeVisible).Count - 1
If x >= 1 Then
.Range(.Cells(2, "A"), .Cells(LR, "E")).SpecialCells(xlCellTypeVisible).Copy _
Destination:=Sheets("Sheet3").Range("A" & Rows.Count).End(xlUp).Offset(1)
End If
.AutoFilterMode = False
End With
End If
End Sub
Bookmarks