sathyaanil37
New Member
- Joined
- Sep 14, 2012
- Messages
- 32
The below macro code is giving wrong count
sheet1 has the following data
empid name loc
1 aaaa ddd
2 bbbb ggg
4 cccc dddd
the 3rd row is empty in sheet1 but still it is showing number of rows as 4 instead of 3.I need macro it will not count if entire row is empty in that sheet and give correct count.
Code:
<CODE>Dim rows As Singlerows = Sheet1.UsedRange.rows.Count - 1MsgBox (rows)</CODE></PRE><!-- END TEMPLATE: bbcode_code -->
empid name loc
1 aaaa ddd
2 bbbb ggg
4 cccc dddd
the 3rd row is empty in sheet1 but still it is showing number of rows as 4 instead of 3.I need macro it will not count if entire row is empty in that sheet and give correct count.