Hi All,
I am having 2 workbooks, in that workbook 1 after filtered 2 or 3 rows visible, in that i have to write the code in those visible cells if G col contains "apple" in the sentence , select that row and copy D and E col paste another sheet, if G col Doesn't contain apple in the text , select that row copy D and E col paste another sheet. i used one code but it is copying all visible cells.
I am having 2 workbooks, in that workbook 1 after filtered 2 or 3 rows visible, in that i have to write the code in those visible cells if G col contains "apple" in the sentence , select that row and copy D and E col paste another sheet, if G col Doesn't contain apple in the text , select that row copy D and E col paste another sheet. i used one code but it is copying all visible cells.
VBA Code:
Sub Rights()
For i = 2 To 5
'Autofill
Worksheets("sheet6").Activate
If InStr(Range("E" & i).Value, "Apple") > 0 Then
ActiveSheet.Range("D2:D").SpecialCells(xlCellTypeVisible).Copy
Worksheets("sheet3").Activate
ActiveSheet.Range("C" & i).PasteSpecial Paste:=xlPasteValues
Else
ActiveSheet.Range("D2:D").SpecialCells(xlCellTypeVisible).Copy
Worksheets("sheet3").Activate
ActiveSheet.Range("C" & i).PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False
End If
Next i
End Sub