There are a few ways that you can do it. The first is to start with the
first row and find the last populated row. Assuming data with every row
filled, you could do something like:

 

iNumberRows = Range("A6").End(xlDown).Row - Range("A6").Row

 

In this case, it assumes your data starts in A6, so it takes the last row
minus the row number for the start (in this case 6) and returns the number
of rows of data.

 

You can do it the other way, working from the bottom up - this will get you
the last used row.

 

iLastRow = Range("A65535").End(xlUp).Row

 

If you want to check a specific set of rows to see if they are populated,
the best way is to use a loop:

 

For iLoop = 1 to 1000

                If Not isBlank(Range("A" & iLoop).Value) Then

                                iCounter = iCounter + 1

                End If

Next iLoop

 

iCounter will tell you the number of non-blank cells.

 

From: excel-macros@googlegroups.com [mailto:excel-mac...@googlegroups.com]
On Behalf Of Ashkaran Badlani
Sent: Friday, March 06, 2009 5:31 PM
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ Need help with VBA Macro...

 

Hi All,

 

How can I check how many rows are filled with data in a macro.

-- 
Thanks & Regards Ashkaran Badlani




--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
Some important links for excel users:
1. Excel and VBA Tutorials(Video and Text), Free add-ins downloads at 
http://www.excelitems.com
2. Excel tutorials at http://www.excel-macros.blogspot.com
3. Learn VBA Macros at http://www.vbamacros.blogspot.com
4. Excel Tips and Tricks at http://exceldailytip.blogspot.com
 

To post to this group, send email to excel-macros@googlegroups.com
If you find any spam message in the group, please send an email to:
Ayush Jain  @ jainayus...@gmail.com or
Ashish Jain @ 26may.1...@gmail.com
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to