Patriot2879
Well-known Member
- Joined
- Feb 1, 2018
- Messages
- 1,259
- Office Version
- 2010
- Platform
- Windows
Hi good morning, I have the code that works great apart when the name cant filter on the name I M2, it goes on a loop about times, until it finally stops and highlights empty fields, is there anyway t stop the loop and return nothing straight away instead?
Code:
Private Sub dofilter()
Sheets("Filter").Select
Range("B2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Clear
Sheets("Work Issue").Select
Range("C:C").AutoFilter Field:=3, Criteria1:=Range("M2").Value
Range("A1").Select
ActiveCell.Offset(1).Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
Sheets("Filter").Select
ActiveSheet.Paste Destination:=Range("C10")
Columns.AutoFit
Range("B2").Select
End Sub