How do I autofill the values in between?
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.
I've not found a great way to do this, ever. There's a not-great workaround I use from time to time:
A
B1: =A1
B2: =IF(A2 = "", B1, A2)
B:B
A:A
B
Make another column to generate them for you. Insert a new column B, make B1
= A1
, then use this formula in 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.
Edit: I am not sure exactly what you mean by "auto-fill"; @corsiKa's formula will result in
11122222333444...
Mine will result in:
12323456345456...
to end up with
use this 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 )
and Insert
» Module
then ALT + F8 to View Macros
» select 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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.