View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Force VBA countif to find string, not value

If you really want VBA, you could use something like:

If ActiveSheet.Evaluate("SumProduct(--(""a1:a100""=""010020""))") 0 then

=sumproduct() can't use the entire column until xl2007.



c mateland wrote:

Excel 2003

In a VBA routine, I'm trying to do a simple countif.

If Application.WorksheetFunction _
.CountIf(Range("a:a"),"010020") 0 Then

This evaluates to TRUE when I expect FALSE.

In the column it's evaluating, I have...

A
10020
10021
10022

It's obviously counting the 10020 entry, but I want an exact match to
the literal criteria I enter.

How do I force the countif to look for the text string, not the value?

Thanks,
Chuck


--

Dave Peterson