如何在下一个可用单元格中填充列的其余部分?

我正在使用下面的代码来分配一个值。

Sheets("CDGL Data").Range("A" & Rows.Count).End(xlUp).Offset(1).Formula= "April" 

我需要"April"填充到其中有值的单元格之间的空白单元格中的相邻行的其余部分。

例如: Cell A899为空, Cell B899有一个值, Cell C899的值为"April"需要放入该空白cell A899

请帮忙!

你可以使用这个:

 Dim lStartRow As Long Dim lEndRow As Long With Sheets("CDGL Data") lStartRow = .Range("A" & .Rows.Count).End(xlUp).Row + 1 lEndRow = Application.Max(.Range("B" & .Rows.Count).End(xlUp).Row, .Range("C" & .Rows.Count).End(xlUp).Row) .Range(.Cells(lStartRow, "A"), .Cells(lEndRow, "A")).Value2 = "April" End With