0

I have seen a bunch of solutions, but all include either checking the whole range or checking a specific cell in a range.

Is there a way to check if there are any empty cells in a specific range?

This is what I am currently using, but thisCount is always 0, even though I know it should be 27 (27 being the number of occupied cells). I have opened debugging mode to, and I see that the range is in fact the one that I want.

range = xlWorkSheet.Range[xlWorkSheet.Cells[rows][1], xlWorkSheet.Cells[rows][columns]];
double thisCount = this.Application.WorksheetFunction.CountA(range);
Adjit
  • 10,134
  • 12
  • 53
  • 98
  • Any insight here in [this answer?](http://stackoverflow.com/a/14508655/4727183) – bjbk Dec 31 '15 at 00:53
  • @bjbk at first I didn't think so, but I may actually be able to make it work, if I check that range for used cells – Adjit Dec 31 '15 at 01:00

1 Answers1

2

If you have a nice rectangular block like A1:D7 then:

=IF(ROWS(A1:D7)*COLUMNS(A1:D7)=COUNTA(A1:D7),"no empties","at least one empty")

In VBA you would check SpecialCells(xlCellTypeBlanks)

Gary's Student
  • 95,722
  • 10
  • 59
  • 99
  • So it is technically a rectangular block, but it's only one row. Does that change anything? Basically, I am trying to check to see if the last row of the spreadsheet is a row of data or a totals row, which would only have 2 cells filled. – Adjit Dec 31 '15 at 00:57