View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default Countif using vba

try this:

r = 2
If Cells(r, 1) = "Marcus" And Cells(r, 2) = "Pink" Then
x = Application.CountIf(Range("A" & r & ":AB" & r), "0")
MsgBox x
End If

Regards,
KL



"Mr M Walker" wrote in message
...
Is it possible to write a "if command" which performs a countif 0 if a
certain criteria is meet. i.e
r= 2
If cells (r,1) = "Marcus" and cells (r,2) = "Pink" then
countif("A2:AB2"0)
end if

I have tried using the fucntion commande with little success

I need to run this code through 10,000 record on a regural basis, it will
alsways countif the same range, however the row will obviously change.

Many thanks in anticipation

Macus