473,405 Members | 2,373 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

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

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

Apr 3 '07 #1
2 4654
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]
- mv*@spam.guard.caspershouse.com

"shantanu" <sh***********@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
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

Apr 3 '07 #2
On Apr 3, 8:13 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
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]
- m...@spam.guard.caspershouse.com

"shantanu" <shantanuse...@gmail.comwrote in message

news:11**********************@n76g2000hsh.googlegr oups.com...
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- Hide quoted text -

- Show quoted text -
Thanx a lot i had the solution

Apr 5 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Hari Om | last post by:
Here are the details of my error log files: I execute the command and get following message at console: ---------------------------------------------------------------------- ../sqlldr...
0
by: Carlos Lozano | last post by:
Hi, I have an application that creates Excel files and I ma having trouble formatting cells. I fill all cells required, sewt fonts and everything, but have a cell that contains multiple text...
3
by: Mike Fellows | last post by:
i have some code that pulls a large amount of data from a database and puts it into an excel spreadsheet, some excel formulas are inserted and the whole lot gets printed out (excel in invisble...
8
by: Doug Bell | last post by:
Hi, I need to create a function that will return the number of columns in a passed reference to a DataView. I can find the number of columns in its underlying Data table but have not been...
68
by: Martin Joergensen | last post by:
Hi, I have some files which has the following content: 0 0 0 0 0 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0
1
by: hartbypass | last post by:
Hello all. I am trying to interate thorugh by GridView data to pump each cell of each row into a stored proc to load to a DB. I seem to be having a heck of a time getting the Columns.Count to...
0
by: Starter in VBA | last post by:
HELP! Need your help in finding how to creating charts with dynamic ranges of cells which are referenced to by variables indicating the beginning and ending of row and column numbers. My...
4
by: grego9 | last post by:
I am trying to write some VBA in Excel 2000 that scans down column L and inserts the Autosum command in each blank cell. Outside of VBA when I click the autosum command excel sums all the cells...
9
by: LucasLondon | last post by:
Hi, Sorry, this is a bit of a lengthy one but I guess too much information is better than less! I have an excel worksheet that I update regulary with latest values from downloaded CSV files....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.