Counting with VBA

  1. Excel Wannabe
    Excel Wannabe
    Hi to all.

    The following code counts matches (0 or 1) between 2 columns (A & B) and lists them in column D, it works well but I'm like to list them in 4 separate columns instead of one...any ideas?
  2. Excel Wannabe
    Excel Wannabe
    Public Sub CountA_FillC()

    Dim RowA As Long, RowB As Long
    Dim UsedRange As Range: Set UsedRange = ActiveSheet.UsedRange
    For RowB = 1 To UsedRange.Rows.Count
    Dim Count As Long: Count = 0
    For RowA = 1 To UsedRange.Rows.Count
    If UsedRange(RowA, "A").Value = UsedRange(RowB, "B").Value Then
    Count = Count + 1
    End If
    Next RowA
    UsedRange(RowB, "D").Value = Count
    Next RowB

    End Sub
Results 1 to 2 of 2

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1