# How to autofill n times of each value in a column, that are separated by different numbers of empty cells

#### Ixcel

##### New Member
I have a column with some values that are separated by different number of empty cells. How can I copy each of these value to the n empty cells below them? In my case n = 3 is no bigger than the minimum number of empty space between them.

#### Attachments

• Screen Shot 2020-12-05 at 10.50.09.png
13.2 KB · Views: 3

### Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

#### MARK858

##### MrExcel MVP
Manually...

Select the range
Ctrl + G
Special
Blanks
Type = and press Ctrl and the Up arrow
Ctrl + Enter
Copy and Paste as values

#### Ixcel

##### New Member
Manually...

Select the range
Ctrl + G
Special
Blanks
Type = and press Ctrl and the Up arrow
Ctrl + Enter
Copy and Paste as values
Thanks for your reply. I know this methods, but it will autofill the value to all the empty cells below it. Like AAAAAAAAABBBBCCCC. I would like each value copied only 3 times, something like AAAA-----BBBBCCCC, -stands for empty cells.

#### MARK858

##### MrExcel MVP
Assuming that your data starts in A2 then maybe...
VBA Code:
``````Sub Ixcel()
Dim i As Long
For i = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
If Cells(i, "A") <> "" Then Cells(i, "A").Resize(4).Value = Cells(i, "A").Value
Next
End Sub``````

Edit:
Or a tiny bit better

VBA Code:
``````Sub Ixcel2()
Dim i As Long
For i = Cells(Rows.Count, "A").End(xlUp).Row To 2 Step -1
If Cells(i, "A") <> "" And WorksheetFunction.CountA(Cells(i, "A").Offset(1).Resize(3)) = 0 Then Cells(i, "A").Resize(4).Value = Cells(i, "A").Value
Next
End Sub``````

Last edited:

Replies
4
Views
107
Replies
9
Views
165
Replies
2
Views
59
Replies
10
Views
221
Replies
7
Views
100

Threads
1,127,806
Messages
5,627,005
Members
416,214
Latest member
boston814

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

### Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

### Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back