![]() |
Simple code to find the empty cells in a range and cells with number
I want to find out how many cells in a given range are empty
Also, since my range can only have numbers in them, it should also check that the non empty cells do not contain text (only numbers) Help to do this in the simplest code possible. |
Simple code to find the empty cells in a range and cells with number
Use SpecialCell Method
http://www.ozgrid.com/VBA/special-cells.htm Some other FUNCTIONS COUNT COUNTBLANK COUNTA COUNTIF -- Regards Dave Hawley www.ozgrid.com "Subodh" wrote in message ... I want to find out how many cells in a given range are empty Also, since my range can only have numbers in them, it should also check that the non empty cells do not contain text (only numbers) Help to do this in the simplest code possible. |
Simple code to find the empty cells in a range and cells with number
You should be able to make use of these...
NumberOfEmptyCells = WorksheetFunction.CountBlank(Selection) NumberOfTextCells = WorksheetFunction.CountIf(Selection, "*") You can substitute and actual range for the Selection range which I used in my examples; for instance.... NumberOfEmptyCells = WorksheetFunction.CountBlank(Range("A1:H9")) NumberOfTextCells = WorksheetFunction.CountIf(Range("A1:H9"), "*") -- Rick (MVP - Excel) "Subodh" wrote in message ... I want to find out how many cells in a given range are empty Also, since my range can only have numbers in them, it should also check that the non empty cells do not contain text (only numbers) Help to do this in the simplest code possible. |
All times are GMT +1. The time now is 04:21 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com