PC Review


Reply
Thread Tools Rate Thread

Count blank cell in a column

 
 
shantanu
Guest
Posts: n/a
 
      3rd Apr 2007
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      3rd Apr 2007
I converted your C code to VBA

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

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
>
>

 
Reply With Quote
 
shantanu
Guest
Posts: n/a
 
      5th Apr 2007
On Apr 3, 4:04 pm, Joel <J...@discussions.microsoft.com> wrote:
> I converted your C code to VBA
>
> Sub ValidateReviewComment()
> 'Range xlsRng = _sheet.get_Range("G1",Type.Missing).EntireColumn;
> 'MessageBox.Show(xlsRng.EntireColumn.Count.ToString());
>
> 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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to count#cells w/= value in other column and not count blank c aganoe Microsoft Excel Worksheet Functions 4 9th Apr 2010 11:36 AM
If Cell in Column C is Blank, Make Adjacent Cell in Column B Blank ryguy7272 Microsoft Excel Programming 6 13th Jul 2009 10:05 PM
count uniques in same column, post in blank cell, repeat until end ofspreadsheet S Himmelrich Microsoft Excel Programming 2 15th Jan 2008 07:31 PM
Count Uniques in Column, put result in next blank cell and continueuntil last row S Himmelrich Microsoft Excel Programming 5 15th Jan 2008 05:31 PM
Count blank cells until a non-blank cell is reached tim Microsoft Excel Worksheet Functions 9 7th Jul 2004 06:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:10 AM.