You can't just add "or 2" to an IF dtatment krzysztof.
You have to pu "or Application.WorksheetFunction.CountA(Rows(r)) = 2"
A neater way would be to use a variable and a select.
ilCount = Application.WorksheetFunction.CountA(Rows(r))
Select case ilCount
Case 0, 2
....
Case Else
End Select