How to automatic insert blank rows depend on 1 column?

204 views Asked by At

I have table same there

enter image description here

and I want automatic insert blank rows depend on the cell in first column, enter image description here

Anyone can help me? I tried many methods but none of it does exactly I need. Sorry for my English.

2

There are 2 answers

1
Monkawee Maneewalaya On

You can add 1 index column as primary key. Then insert only index column and your PK with all blank fields.

2
0m3r On

Create button and assign to the following macro

Sub BRow()
    Dim WorkRng As Range
    Dim FirstRow As Integer
    Dim lngRows As Integer
    Dim lngCols As Integer

    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox("Select Range", WorkRng.Address, Type:=8)
    FirstRow = WorkRng.Row
    lngRows = WorkRng.Rows.Count
    lngCols = WorkRng.Columns.Count
    WorkRng.Cells(lngRows, 1).Resize(1, lngCols).Select

    Do Until Selection.Row = FirstRow
        Selection.Insert shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
        Selection.Offset(-1, 0).Select
    Loop
End Sub

See Examples here