Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I need to test an entire column to see if there are any non-blank cells in
the column. I've tried writing an expression using CountA(), but I can't get it to work. Can anyone tell me how I could test, say, Column C, to see if there are any blank cells in that column? Thank you in advance. Paul |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Paul
Dim intNo as Integer intNo = Application.CountBlank(ActiveWorkbook.Worksheets(1 ).Range("C:C")) Heiko :-) "Paul James" wrote: I need to test an entire column to see if there are any non-blank cells in the column. I've tried writing an expression using CountA(), but I can't get it to work. Can anyone tell me how I could test, say, Column C, to see if there are any blank cells in that column? Thank you in advance. Paul |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Paul,
This is one way to do it. I've used a range in the function to ensure that if this is used as a UDF it can reference another sheet if needed. If your in XL97 you'll need to change the line that sets lrow to 16384 (or whatever the max rows is). Public Function IsColumnEmpty(rngTest As Range) As Boolean Dim lRow As Long Dim nCol As Integer nCol = rngTest.Column With rngTest.Parent lRow = .Cells(65536, nCol).End(xlUp).Row If lRow = 1 And IsEmpty(.Cells(lRow, nCol).Value) Then _ IsColumnEmpty = True End With End Function Robin Hammond www.enhanceddatasystems.com Check out our XspandXL add-in "Paul James" wrote in message news:ULJWa.46245$uu5.5082@sccrnsc04... I need to test an entire column to see if there are any non-blank cells in the column. I've tried writing an expression using CountA(), but I can't get it to work. Can anyone tell me how I could test, say, Column C, to see if there are any blank cells in that column? Thank you in advance. Paul |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Paul,
Doesn't =COUNTA(C:C) tell you if there are some non-blank cells. It picks up formulae and values. The number of rows is 65536 (97 and above), so if it's less than that number there are balnsk =IF(COUNTA(C:C)<65536,"you have blanks","no blanks") -- HTH Bob Phillips "Paul James" wrote in message news:ULJWa.46245$uu5.5082@sccrnsc04... I need to test an entire column to see if there are any non-blank cells in the column. I've tried writing an expression using CountA(), but I can't get it to work. Can anyone tell me how I could test, say, Column C, to see if there are any blank cells in that column? Thank you in advance. Paul |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
=if(countA(C:C)=0,"All Blank","Blanks: "&rows(C:C)-CountA(C:C))
if you want to find blanks only up to the last used cell =IF(COUNTA(C:C)=0,"All Blank","Blanks: "&MATCH(9.99999999999999E+307,C:C)-COUNTA(C:C)) if only numeric values are contained in column C or for only non-numeric entries: =IF(COUNTA(C:C)=0,"All Blank","Blanks: "&MATCH(REPT("Z",255),C:C)-COUNTA(C:C)) Actually, the restriction is only to the type of data in the last populated cell. -- Regards, Tom Ogilvy Paul James wrote in message news:ULJWa.46245$uu5.5082@sccrnsc04... I need to test an entire column to see if there are any non-blank cells in the column. I've tried writing an expression using CountA(), but I can't get it to work. Can anyone tell me how I could test, say, Column C, to see if there are any blank cells in that column? Thank you in advance. Paul |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Testing Cells | New Users to Excel | |||
TESTING A RANGE OF CELLS | New Users to Excel | |||
TESTING A RANGE OF CELLS | Excel Worksheet Functions | |||
Testing Spreadsheet Cells while in a Macro | Excel Discussion (Misc queries) | |||
Excel - Autom. Filter "Empty / Non Empty cells" should come first | Excel Discussion (Misc queries) |