Excel: Copy and Paste Row to another sheet IF Column E does not equal BAS or DPO


Hello, I hope you are doing well. I have a question. I am looking for vba code that will place data from sheet 1 to sheet 2 (for example) if the value in column F equals 25411013 AND column E in the same row does not equal BAS or DPO. Sample code I have so far: LR = Cells(Rows.Count, "E").End(xlUp).Row With Range("E2:F" & LR) .AutoFilter .AutoFilter Field:=1, Criteria1:="25411013" .SpecialCells(xlCellTypeVisible).EntireRow.Copy Destination:=Sheets("Sheet2").Range("A2") .AutoFilter End With The above code will simply place all rows with a value of 25411013 in it to the Sheet2 sheet. I am looking for code that will place all rows with a value of 25411013 on Sheet2 UNLESS the value of column E in the same row equals BAS or DPO. I would greatly appreciate any help you could give me concerning this matter!!


This question generated 17 answers. To proceed to the answers, click here.

This thread is current as of August 16, 2014.


For more resources for Microsoft Excel