I have this piece of code
        
        ar = ActiveCell.Row
        val = Application.WorksheetFunction.CountIf(Sheets("AB").Range("B:B"), ActiveCell.Value)
        Rows("val:ar").EntireRow.Insert shift:=xlDown
ar and val both return numeric values but the last string of my code returns "run-time error '1004': Application-defined or object-defined error.

Any ideeas? tnx.