LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default Counta anomaly

The key thing here is how you set the values of cell2 and cell3, and you
didn't post that code which you should have. But based on your description,
you're passing Counta the "value" of the cells rather than the cells
themselves. The value of empty cells is 0 for many purposes (e.g., enter
=A1 in a cell and it returns 0 even though A1 is empty) and 0 is not empty.

These examples illustrate what I think is going on. In both, A1 and A2 are
empty:

Sub Bad()
Dim Cell1Val As Variant
Dim Cell2Val As Variant
Cell1Val = Range("A1").Value
Cell2Val = Range("A2").Value
MsgBox Application.CountA(Cell1Val, Cell2Val) ''2
End Sub

Sub Good()
Dim Cell1Rg As Range
Dim Cell2Rg As Range
Set Cell1Rg = Range("A1")
Set Cell2Rg = Range("A2")
MsgBox Application.CountA(Cell1Rg, Cell2Rg) ''0
End Sub


--
Jim Rech
Excel MVP


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Top N Pivot Anomaly PatK Excel Discussion (Misc queries) 0 April 10th 09 10:14 PM
Date anomaly HaoHoaMastercard Excel Discussion (Misc queries) 4 October 11th 07 08:05 PM
Sort anomaly supersheet Excel Worksheet Functions 0 August 28th 07 06:57 PM
VLOOKUP Anomaly Tosca Excel Worksheet Functions 6 May 8th 05 09:08 AM
COUNTA Function not working =COUNTA(C3:C69,"NH") MikeinNH Excel Worksheet Functions 2 November 8th 04 01:19 AM


All times are GMT +1. The time now is 02:27 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"