udigold1
08-28-2008, 12:53 PM
I have this problem:
I have 2 ranges with values, and I want to use countif to see of there's a same value in each of these ranges.
I wrote a code like this:
Sub countme()
Rng = Range("rngoriginal")
Range("criteria").Select
For Each cell In Selection
If Application.WorksheetFunction.CountIf(Rng, cell) > 0 Then
cell.EntireRow.Font.Bold = True
End If
Next cell
End Sub
but everytime I get to If line I get an error.
What am I doing wrong?
Thanks
Udi
I have 2 ranges with values, and I want to use countif to see of there's a same value in each of these ranges.
I wrote a code like this:
Sub countme()
Rng = Range("rngoriginal")
Range("criteria").Select
For Each cell In Selection
If Application.WorksheetFunction.CountIf(Rng, cell) > 0 Then
cell.EntireRow.Font.Bold = True
End If
Next cell
End Sub
but everytime I get to If line I get an error.
What am I doing wrong?
Thanks
Udi