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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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,215,032
Messages
6,122,772
Members
449,095
Latest member
m_smith_solihull

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