Copy the cells to adjacent after auto filter.
Team,
I have some values in column A where they include the negative and positive values and where i wrote the below one to filter and copy the same in adjacent column.
But i require is After filtering if a3, a7, a8 are having negative values they should copy to adjacent cells that is b3, b7, b8.Am unable to get it.
Please help........
Sub AutoFilter_in_Excel()
Range("A1").AutoFilter Field:=1, Criteria1:="<0", Operator:=xlAnd
Worksheets("sheet1").Range("A2:A7").Copy _
Destination:=Worksheets("sheet1").Range("c2")
Range("A1").AutoFilter Field:=1, Criteria1:=">0", Operator:=xlAnd
Worksheets("sheet1").Range("A2:A7").Copy _
Destination:=Worksheets("sheet1").Range("b2")
End Sub
Re: Copy the cells to adjacent after auto filter.
Thread moved to the 'Office Development/VBA' forum... note that while it certainly isn't made clear, the "VB Editor" in Office programs is actually VBA rather than VB, so the 'VB6' forum is not really apt
Re: Copy the cells to adjacent after auto filter.
If you know which cells you need to check, it can be like this:
Code:
If Range("a3").Value < 0 Then Range("b3").Value = Range("a3").Value