
如何自动填充两者之间的值?
Select Column A, CTRL+G -> Blanks -> OK
Type = press UpArrow, then press CTRL+ENTER
See this link for explanation. It is basically find all blanks and enter a formula to all of them.
EDIT: as @kurast pointed out for safety/sanity reasons select all and Copy and Paste Special as Values.
我从来没有找到一个很好的方法来做到这一点。我不时使用一个不太好的解决方法:
AB1: =A1B2: =IF(A2 = "", B1, A2)B:BA:AB制作另一列为您生成它们。插入一个新列 B,make B1= A1,然后在 中使用这个公式B2:
=IF(A2="",B1+1,A2)
并把它拖下来;它将执行您想要的逻辑。
然后您可以复制 B 列和paste special values->values以“硬编码”结果。
编辑:我不确定您所说的“自动填充”是什么意思;@corsiKa 的公式将导致
11122222333444...
我的会导致:
12323456345456...
以结束

用这个VBA
Sub FillValues()
Dim c As Range
For Each c In Range("A1:A" & Range("B" & Rows.Count).End(xlUp).Row)
If IsEmpty(c) Then c = c.Offset(-1, 0)
Next c
End Sub
点击ALT+F11打开 VBE,然后右键单击Project Explorer( CTRL+ R)
和Insert»然后+到» 选择Module
ALTF8View MacrosFillValues
要得到

利用
Sub FillValues()
Dim c As Range
For Each c In Range("A1:A" & Range("B" & Rows.Count).End(xlUp).Row)
If IsEmpty(c) Then c = c.Offset(-1, 0) +1
Next c
End Sub