Hi,
i am having a little trouble with my vba code. I seem to have an error in my countif vba formula. I need B2 to have the formula for countif on range D2 thru last row. The criteria will be D2 (for B2)...D3 (for B3)...D4 (for B4)...and so on.
i am having a little trouble with my vba code. I seem to have an error in my countif vba formula. I need B2 to have the formula for countif on range D2 thru last row. The criteria will be D2 (for B2)...D3 (for B3)...D4 (for B4)...and so on.
Code:
Range("B1").Select
ActiveCell.FormulaR1C1 = "CountIf"
Range("B2").Formula = "=COUNTIF(D2:D"&lastrow",D2)"
Range("B2").Select
Selection.AutoFill Destination:=Range("B2:B" & lastrow)