I'm trying to count the number of instances of a cell containing all uppercase characters in a user defined range, I've got some code already which loops through and highlights those uppercase cells correctly, but I'm struggling to apply that logic to VBA's Countif function. Here's the code I've got but its giving a mismatch error:

```
'count instances of all caps
Dim allcaps As Long
allcaps = Application.CountIf(Range(rngCompany.Cells(1, 1), rngCompany.Cells(Lastrow, 1)), UCase(Range(rngCompany.Cells(1, 1), rngCompany.Cells(Lastrow, 1))))

MsgBox "There are " & allcaps & " uppercase company names to review."

```

The code which is highlighting the cells correctly is:

```
'Highlight all caps company names for review
With ws
    For i = 2 To Lastrow
        ' checks if cells in company name col are uppercase
        If rngCompany.EntireColumn.Cells(i, 1).Value = UCase(rngCompany.EntireColumn.Cells(i, 1).Value) Then
            wbk1.Sheets(1).Rows(i).Interior.ColorIndex = 6 '6: Yellow
        Else
            End If

    Next i
End With

```

Is there a way to make the countif code work in a similar way within the loop? Thanks.