简体   繁体   中英

Excel auto fill column by X+++..Y++..Z+

EXL

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:

  1. Insert a column after A
  2. Copy the first value over - so B1: =A1
  3. Starting at B2, drag the formula of B2: =IF(A2 = "", B1, A2)
  4. Copy B:B
  5. Paste values into A:A
  6. Delete column 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

simulate2

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM