My excel sheet looks like this
row 1 to row 150 have data and formating
row 151 to row 1600 have formating only

I need to find out the last row with DATA ONLY in Excel, however when I use the code below the count shows 1600 - all rows that have cell formating (backcolor etc) applied even if those cells have no data in them.

VB Code:
  1. UsedRange.Rows.Count

I also tried these with same problem:
VB Code:
  1. ws.Cells.SpecialCells(xlCellTypeLastCell).row
  2.   xlApp.ActiveCell.SpecialCells(xlLastCell).Address(RowAbsolute:=False)
  3.   ws.UsedRange.Rows.Count
  4.   ActiveCell.SpecialCells(xlLastCell).row


How can I get the count of all the rows with data only.