[英]Excel auto fill column by X+++..Y++..Z+
How do I autofill the values in between? 如何在两者之间自动填充值?
Select Column A, CTRL+G
-> Blanks
-> OK
Type =
press UpArrow
, then press CTRL+ENTER
选择A列,
CTRL+G
- > Blanks
- > OK
类型=
按UpArrow
,然后按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. 编辑:因为@kurast指出出于安全/理智的原因选择全部并复制和粘贴特殊值作为值。
I've not found a great way to do this, ever. 我永远找不到一个好方法。 There's a not-great workaround I use from time to time:
我经常使用一个不太好的解决方法:
A
A
之后插入一列 B1: =A1
B1: =A1
B2: =IF(A2 = "", B1, A2)
B2: =IF(A2 = "", B1, A2)
B:B
B:B
A:A
A:A
B
B
列 Make another column to generate them for you. 创建另一列以便为您生成它们。 Insert a new column B, make
B1
= A1
, then use this formula in B2
: 插入一个新列B,使
B1
= A1
,然后在B2
使用此公式:
=IF(A2="",B1+1,A2)
And drag it down; 把它拖下来; it will perform the logic you want.
它会执行你想要的逻辑。
Then you can copy column B, and paste special values
-> values
to "hard-code" the results. 然后,您可以复制B列,并
paste special values
- > values
以“硬编码”结果。
Edit: I am not sure exactly what you mean by "auto-fill"; 编辑:我不确定你的意思是“自动填充”; @corsiKa's formula will result in
@ corsiKa的公式将导致
11122222333444...
Mine will result in: 我的结果将是:
12323456345456...
to end up with 结束
use this VBA
使用这个
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
hit ALT + F11 to open VBE, then right click in the Project Explorer
( CTRL + R ) 点击ALT + F11打开VBE,然后右键单击
Project Explorer
( CTRL + R )
and Insert
» Module
并
Insert
» Module
then ALT + F8 to View Macros
» select FillValues
然后ALT + F8
View Macros
»选择FillValues
to get 要得到
use 采用
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.