#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count


I'm trying to determine how many numeric values are contained within a
range filled with many blanks. I've tried both the ISNUMERIC and the
ISBLANK code, the first just counts all the cells even the blanks, and
the second gives me an error when i run the program

Here is the code:
For C = Row To value
NotBlank = IsNumeric(range(f_column & C))
If NotBlank = True Then
NoBlanks = NoBlanks + 1
End If
Next C

Any ideas????
Thanks in advance,

dani


--
Dani
------------------------------------------------------------------------
Dani's Profile: http://www.excelforum.com/member.php...o&userid=23542
View this thread: http://www.excelforum.com/showthread...hreadid=383153

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,339
Default Count

Hi,

Try

NotBlank = Application.IsNumber(range(f_column & C))

HTH

"Dani" wrote:


I'm trying to determine how many numeric values are contained within a
range filled with many blanks. I've tried both the ISNUMERIC and the
ISBLANK code, the first just counts all the cells even the blanks, and
the second gives me an error when i run the program

Here is the code:
For C = Row To value
NotBlank = IsNumeric(range(f_column & C))
If NotBlank = True Then
NoBlanks = NoBlanks + 1
End If
Next C

Any ideas????
Thanks in advance,

dani


--
Dani
------------------------------------------------------------------------
Dani's Profile: http://www.excelforum.com/member.php...o&userid=23542
View this thread: http://www.excelforum.com/showthread...hreadid=383153


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Count


I tried it but it still doesn't work....

is there any other ideas????


-dani


--
Dani
------------------------------------------------------------------------
Dani's Profile: http://www.excelforum.com/member.php...o&userid=23542
View this thread: http://www.excelforum.com/showthread...hreadid=383153

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Count

Hi Dani,

Try:

'====================
Sub Tester()

Dim rng As Range
Dim iCnt As Long

Set rng = Range("A1:D20") '<<==== CHANGE
On Error Resume Next
iCnt = Intersect(Selection, rng. _
SpecialCells(xlCellTypeConstants, xlNumbers)). _
Cells.Count
On Error GoTo 0
MsgBox iCnt
End Sub
'<====================

or:

'====================
Sub Tester2()

Dim rng As Range, rcell As Range
Dim iCnt As Long

Set rng = Range("A1:D20") '<<==== CHANGE

For Each rcell In rng
If Not IsEmpty(rcell) Then
If IsNumeric(rcell) Then iCnt = iCnt + 1
End If
Next

MsgBox iCnt
End Sub
'<====================

The first method will fail if the range comprises more than 8192 contiguous
areas but may be faster. The error handler is used to catch the error
produced if the SpecialCells method is unable to find a cell.

The second method should work in all likely scenarios and, unless the range
area is very large, should have little discernable speed overhead.

---
Regards,
Norman



"Dani" wrote in message
...

I'm trying to determine how many numeric values are contained within a
range filled with many blanks. I've tried both the ISNUMERIC and the
ISBLANK code, the first just counts all the cells even the blanks, and
the second gives me an error when i run the program

Here is the code:
For C = Row To value
NotBlank = IsNumeric(range(f_column & C))
If NotBlank = True Then
NoBlanks = NoBlanks + 1
End If
Next C

Any ideas????
Thanks in advance,

dani


--
Dani
------------------------------------------------------------------------
Dani's Profile:
http://www.excelforum.com/member.php...o&userid=23542
View this thread: http://www.excelforum.com/showthread...hreadid=383153



Reply
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
Count Employee Work Time - Don't Double-count Overlapping Apts. J Excel Worksheet Functions 0 April 27th 07 05:52 AM
Excel 2000, count, sort a list & count totals? sunslight Excel Worksheet Functions 1 April 9th 07 05:46 PM
Count Intervals of 2 Consecutive Values in same Row and Return Count across Row Sam via OfficeKB.com Excel Worksheet Functions 6 November 29th 05 03:27 PM
Count Intervals of 1 Numeric value in a Row and Return Count down Column Sam via OfficeKB.com Excel Worksheet Functions 8 October 4th 05 04:37 PM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Excel Worksheet Functions 9 July 31st 05 03:37 AM


All times are GMT +1. The time now is 09:35 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"