I have a macro to extract and sort the data I want from complicated, messy charts used at my job, and it works well except that empty cells in the selected area cause it to miscount the rows and so omit data. Could someone please guide me to a piece of code that would fill any empty cells in a selected area with zeroes? Thanks in advance.
This is the row-counting function that malfunctions when empty cells are present:
Function GetNumberOfRows() As Integer
Dim FirstCell As Range
Set FirstCell = Sheets("Results").Range("b1")
Dim i As Integer
i = 0
Do
i = i + 1
Loop Until FirstCell.Offset(i, 0).Value = ""
GetNumberOfRows = i
End Function
Bookmarks