Simple code to find the empty cells in a range and cells with number

  • Thread starter Thread starter Subodh
  • Start date Start date
S

Subodh

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.
 
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"), "*")
 
Back
Top