koi
Member
Hi there,
i have this code below that works just fine by using autofilter.selection, problem is when it filter and not find the word "old", it still copy first non blank cell there.
can we add like if not find "old" in auto filter then just skip to next ?
thanks all for the help
i have this code below that works just fine by using autofilter.selection, problem is when it filter and not find the word "old", it still copy first non blank cell there.
can we add like if not find "old" in auto filter then just skip to next ?
thanks all for the help
Code:
Sub rec()
Sheets("1").Select
Range("B1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$E$4").AutoFilter Field:=5, Criteria1:="old"
Set Rng = Range("B2", Range("B" & Rows.Count).End(xlUp).Offset(1, 3))
Rng.SpecialCells(xlCellTypeConstants).Copy
sheets("summary").Select
Range("B65536").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
Sheets("1").Select
Selection.AutoFilter
Sheets("2").Select
Range("B1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$E$4").AutoFilter Field:=5, Criteria1:="old"
Set Rng = Range("B2", Range("B" & Rows.Count).End(xlUp).Offset(1, 3))
Rng.SpecialCells(xlCellTypeConstants).Copy
sheets("summary").Select
Range("B65536").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
Sheets("2").Select
Selection.AutoFilter
Sheets("3").Select
Range("B1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$E$4").AutoFilter Field:=5, Criteria1:="old"
Set Rng = Range("B2", Range("B" & Rows.Count).End(xlUp).Offset(1, 3))
Rng.SpecialCells(xlCellTypeConstants).Copy
sheets("summary").Select
Range("B65536").End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlAll, Operation:=xlNone, SkipBlanks:=True, Transpose:=False
Application.CutCopyMode = False
Sheets("3").Select
Selection.AutoFilter
sheets("summary").Select
End Sub