[英]Select last non-empty cell in column A --> Fill down empty cells below in column A, based on last non-empty cell in column C --> Repeat
I would like to fill down the last-non empty cell value in Column A in Excel.我想填写 Excel A 列中最后一个非空单元格值。 It should stop filling down once it reaches the count for the last non-empty cell in Column C. Here is an example:一旦达到 C 列中最后一个非空单元格的计数,它应该停止填充。 这是一个示例:
It should look like this:它应该是这样的:
Would like to repeat this for the last non-empty cell;想对最后一个非空单元格重复此操作;
This is the closest I've gotten to what I'm looking for, but I don't want to select A2 every time.这是我得到的最接近我正在寻找的东西,但我不想每次都选择 A2。 I would like to select the last non-empty cell in column A each time.我想每次都选择 A 列中的最后一个非空单元格。
Dim lrowc As Integer
lrowc = SavedData.Cells(Rows.Count, "C").End(xlUp).Row
SavedData.Range("A2:A" & lrowc).FillDown
Seems to be the same principle as you are using for column C - find the last used cell in A and then use FillDown
:似乎与您用于 C 列的原理相同 - 在 A 中找到最后使用的单元格,然后使用FillDown
:
Sub x()
Dim lrowc As Long, n As Long
With SavedData 'assume defined somewhere
n = .Cells(Rows.Count, "A").End(xlUp).Row 'last filled cell in A
lrowc = .Cells(Rows.Count, "C").End(xlUp).Row 'last filled cell in C
.Range("A" & n & ":A" & lrowc).FillDown
End With
End Sub
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.