count the number of cells which are blank in a excel column

  • Thread starter Thread starter shantanu
  • Start date Start date
S

shantanu

Dear All
My requirement is to count the number of cells which are
blank in a excel column, for that i am writing the following
code;;;;;;;;;;;;;;;;;

private void ValidateReviewComment()
{
//Range xlsRng = _sheet.get_Range("G1",Type.Missing).EntireColumn;
//MessageBox.Show(xlsRng.EntireColumn.Count.ToString());
Range xlsRng = _sheet.UsedRange;
MessageBox.Show("xlsRng.Rows.Count "+xlsRng.Rows.Count.ToString());
for (int i = 2; i <= xlsRng.Rows.Count; i++)
{

if(xlsRng.Cells.Value2==null)
{
MessageBox.Show(i.ToString());
}
}
}

kindly assist me
thanks
shantanu
 
Shantanu,

The Value property of the Range instance (for each individual cell)
should be null, or a Missing value. Either way, when you iterate through
the used cells in the column, it should stick out instantly when you look at
the value in the debugger.

Hope this helps.
 
Shantanu,

The Value property of the Range instance (for each individual cell)
should be null, or a Missing value. Either way, when you iterate through
the used cells in the column, it should stick out instantly when you look at
the value in the debugger.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




Dear All
My requirement is to count the number of cells which are
blank in a excel column, for that i am writing the following
code;;;;;;;;;;;;;;;;;
private void ValidateReviewComment()
{
//Range xlsRng = _sheet.get_Range("G1",Type.Missing).EntireColumn;
//MessageBox.Show(xlsRng.EntireColumn.Count.ToString());
Range xlsRng = _sheet.UsedRange;
MessageBox.Show("xlsRng.Rows.Count "+xlsRng.Rows.Count.ToString());
for (int i = 2; i <= xlsRng.Rows.Count; i++)
{

kindly assist me
thanks
shantanu- Hide quoted text -

- Show quoted text -

Thanx a lot i had the solution
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top