display sequential blanks in column of numbers

dunlopoil

Board Regular
Joined
May 29, 2008
Messages
92
Hi, I want to take a list of numbers in column A, and associated names in column B, and insert blank rows as required. For example, change:

101
103
106

to 101, blank, 103, blank, blank, 106. The data in column B obviously still needs to remain associated with the relevant number.

Thanks.
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Code:
'assumes that data is sorted in ascending order, begins in
'row 1, and is in column 1
Sub YurSub()
    Dim r, i
    
    Application.ScreenUpdating = False
    
    r = Cells(Rows.Count, 1).End(xlUp).Row
    Do Until r = 1
        For i = 1 To Cells(r, 1).Value - Cells(r - 1, 1).Value - 1
            Cells(r, 1).Insert Shift:=xlDown
        Next
        r = r - 1
    Loop
End Sub
 
Upvote 0

Forum statistics

Threads
1,214,901
Messages
6,122,157
Members
449,068
Latest member
shiz11713

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