Hi
I try copying data from A:G if the columns C,F just contains values together . should ignore two cases if the column C,F contains zero together or columns D,E one of them contains values
this the code . currently copy whole data without exceptions
I try copying data from A:G if the columns C,F just contains values together . should ignore two cases if the column C,F contains zero together or columns D,E one of them contains values
this the code . currently copy whole data without exceptions
VBA Code:
Sub arrange()
Dim r As Range
Sheets("sh").Cells(1).CurrentRegion.Clear
With ActiveSheet
Set r = .Cells.SpecialCells(4).EntireColumn.Range("G1:G2")
r(2).Formula = "=AND(n(C2)<>0,n(F2)<>0)"
.Range("A1", .Range("A" & Rows.Count).End(xlUp)).Resize(, 7).AdvancedFilter 2, r, Sheets("sh").Cells(1)
r.Clear
End With
With Sheets("sh").Cells(1).CurrentRegion
If .Rows.Count > 1 Then
.Offset(1).Resize(.Rows.Count - 1).Columns(1) = Evaluate("row(1:" & .Rows.Count - 1 & ")")
End If
End With
End Sub
I hope finding help