View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
GatesAntichrist GatesAntichrist is offline
external usenet poster
 
Posts: 1
Default Leo Heuser format cleanup code, and a question

( DeleteUnusedCustomNumberFormats() , May 6
2001)
Leo's fine code seems to still hold up but has a killer problem
simulated below:
In XL2002, start a fresh sheet. "General" should be the default cel
format.
Type the mere digit 0 in cell A1. It ought to look like a 0, and b
General format.
A2 =COUNTIF(A1:A1,"0.0%")
A2 gets a 1 … ouch.

Those of you USENET vets who are in harmony with the code and Leo ca
see how this gives a false negative, ruining the results. Th
Application.COUNTIF here "tells" the code that "0.0%" is already show
in the "formats being used" column list, though it isn't; it neve
makes it in the "used" column and ultimately shows as unused. It i
not warm and fuzzy when you delete the format relying on that info!

Now for those of you that don't have the code or don't recall it o
don't follow along with the above paragraph:
1. Is this behavior new with XL2002? (that the countif returns 1 an
not 0)
2. Is COUNTIF really looking for text, or is it cleverl
type-converting? Can I "cast" somehow to subvert that?
3. Is the way out of this mess to use .Find method? O
Application.[something else]?

TI

--
Message posted from http://www.ExcelForum.com