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

Ixcel

New Member
Joined
Dec 5, 2020
Messages
2
Platform
  1. MacOS
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
    Screen Shot 2020-12-05 at 10.50.09.png
    13.2 KB · Views: 3

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Manually...

Select the range
Ctrl + G
Special
Blanks
Type = and press Ctrl and the Up arrow
Ctrl + Enter
Copy and Paste as values
 
Upvote 0
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.
 
Upvote 0
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:
Upvote 0

Forum statistics

Threads
1,214,957
Messages
6,122,472
Members
449,087
Latest member
RExcelSearch

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

Which adblocker are you using?

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
Back
Top