Countif Function
' Macro Program to Countif Function in Column B and result in F
Sub ProgramCountif()
'
Sheets("Sheet1").Cells(2, 6).Select
ActiveCell.Formula = "=COUNTIF(B2:$B$2,B2)"
Range("B2").Select
Selection.End(xlDown).Select
Lastcell = ActiveCell.Row
Rng = "F" & Lastcell
Range(Rng).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown
Selection.End(xlUp).Select
End Sub
Sub ProgramCountif()
'
Sheets("Sheet1").Cells(2, 6).Select
ActiveCell.Formula = "=COUNTIF(B2:$B$2,B2)"
Range("B2").Select
Selection.End(xlDown).Select
Lastcell = ActiveCell.Row
Rng = "F" & Lastcell
Range(Rng).Select
Range(Selection, Selection.End(xlUp)).Select
Selection.FillDown
Selection.End(xlUp).Select
End Sub
Comments
Post a Comment