I have a macro to count the number of used rows in a sheet and print the count in a cell in another sheet
Activesheet.Range("O9") = (Worksheets("Another_Sheet").UsedRange.Rows.Count) - 1
every time the values in "Another_sheet" will be cleared
Worksheets("Another_Sheet").UsedRange.Clear
and new set of rows will be printed and Activesheet.Range("O9") will hold the new value.
But the problem is, even if there are no values printed in "Another_Sheet", macro still prints number of rows that were there earlier and got cleared
I also tried Worksheets("Another_Sheet").UsedRange.SpecialCells(xlCellTypeLastCell).Row