The way you would do that using Excel functions would be
to use CountA (counts non-blank cells).
so, in VBA you can use:
Rowcnt = Application.worksheetfunction.counta(range(Cells(R,1),Cells(R,100))

 



________________________________
From: xxx <[email protected]>
To: MS EXCEL AND VBA MACROS <[email protected]>
Sent: Wednesday, March 25, 2009 5:58:55 AM
Subject: $$Excel-Macros$$ count number of occupied cells in every row


Hi all,
I need some help since i an beginner in vba programming
I have say an excel table as below:

1 2 3 4 5
2 3 4 5 6 6 78 8 9
hdg dg gdh gj
fsf
sf sfs sfs sf

in this table I have to count number of occupied cells in every row

in first row the result should be 5
In second row: 9
third row:  4
fourth row : 1
and in fifth : 4

Thank you for any help


--~--~---------~--~----~------------~-------~--~----~
-------------------------------------------------------------------------------------
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 [email protected]
If you find any spam message in the group, please send an email to:
Ayush Jain  @ [email protected] or
Ashish Jain @ [email protected]
-------------------------------------------------------------------------------------
-~----------~----~----~----~------~----~------~--~---

Reply via email to