My code produces an extra row, whenever I fill any data at row 4 column T.
If I leave row 4 column T empty, it will display data at row 5.
Sub All_N()
Dim ws As Worksheet
Sheets("sum").Activate
Sheets("sum").Range("A5:T1048576").Select
Selection.ClearContents
Sheets("sum").Range("A5").Select
For Each ws In ActiveWorkbook.Worksheets
If ws.Name <> "sum" Then
cont1 = Application.WorksheetFunction.CountA(ws.Range("T3:T1048576")) + 2
For a = 2 To cont1
If ws.Cells(a, 20) = "N" Then
b = Application.WorksheetFunction.CountA(Sheets("sum").Range("T3:T1048576")) + 5
Sheets("sum").Cells(b, 1) = ws.Cells(a, 1)
Sheets("sum").Cells(b, 2) = ws.Cells(a, 2)
Sheets("sum").Cells(b, 18) = ws.Cells(a, 18)
Sheets("sum").Cells(b, 19) = ws.Cells(a, 19)
Sheets("sum").Cells(b, 20) = ws.Cells(a, 20)
End If
Next a
End If
Next
End Sub