Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Count blank cell in a column

Dear All
My requirement is to count the number of cells which are
blank in a excel column, for taht 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Count blank cell in a column

I converted your C code to VBA

Sub ValidateReviewComment()
'Range xlsRng = _sheet.get_Range("G1",Type.Missing).EntireColumn;
'MessageBox.Show(xlsRng.EntireColumn.Count.ToStrin g());

Lastrow = Cells(Rows.Count, 1).End(xlUp).Row
Set xlsrange = Range(Cells(1, 1), Cells(Lastrow, 1))

BlankCount = 0
MsgBox ("LastRow = " & Val(Lastrow))
For Each cell In xlsrange

If IsEmpty(cell.Value) Then
BlankCount = BlankCount + 1
MsgBox ("BlankCount = " & Val(BlankCount))
End If
Next cell

End Sub


"shantanu" wrote:

Dear All
My requirement is to count the number of cells which are
blank in a excel column, for taht 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


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default Count blank cell in a column

On Apr 3, 4:04 pm, Joel wrote:
I converted your C code to VBA

Sub ValidateReviewComment()
'Range xlsRng = _sheet.get_Range("G1",Type.Missing).EntireColumn;
'MessageBox.Show(xlsRng.EntireColumn.Count.ToStrin g());

Lastrow = Cells(Rows.Count, 1).End(xlUp).Row
Set xlsrange = Range(Cells(1, 1), Cells(Lastrow, 1))

BlankCount = 0
MsgBox ("LastRow = " & Val(Lastrow))
For Each cell In xlsrange

If IsEmpty(cell.Value) Then
BlankCount = BlankCount + 1
MsgBox ("BlankCount = " & Val(BlankCount))
End If
Next cell

End Sub



"shantanu" wrote:
Dear All
My requirement is to count the number of cells which are
blank in a excel column, for taht 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- Hide quoted text -


- Show quoted text -


sorry did not help
Thanx a lot i had the solution

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to count#cells w/= value in other column and not count blank c aganoe Excel Worksheet Functions 4 April 9th 10 11:36 AM
How do I count the items in one column if another column is blank dereksmom Excel Worksheet Functions 1 November 8th 06 11:34 PM
Only count columns if the column next to it is not blank glotgering Excel Discussion (Misc queries) 2 March 30th 06 09:51 PM
Count Non Blank in column Diane Alsing Excel Discussion (Misc queries) 3 September 16th 05 03:12 AM
COUNT NON-BLANK CELLS WITH REFERENCE TO ANOTHER COLUMN carricka Excel Worksheet Functions 1 May 6th 05 04:50 PM


All times are GMT +1. The time now is 09:33 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"