在表格中find空白单元格的Lastrow

lastrow = ThisWorkbook.Sheets("Numbers").Cells(Rows.Count, 1).End(xlUp).Row 

我有数据,直到第55行,但最后一行给我70,因为公式被拖动到第70行,并从55到70行包含一个空格,根据公式。 我怎样才能避免这一点?

循环范围内的所有单元格,然后找出第一个非空白单元格。 将lastrow设置为该单元格

 lastrow = ThisWorkbook.Sheets("Numbers").Cells(Rows.Count, 1).End(xlUp).Row for i = lastrow to 1 step -1 if ThisWorkbook.Sheets("Numbers").Cells(i, 1) <> " " then lastrow = i exit for end if next