Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EXCEL2000 - Inserting Lines 3

Status
Not open for further replies.

pjmdesigns

Technical User
Mar 7, 2003
39
GB
I have a spreadsheet of a couple of thousand consecutive rows of data, i.e:

1
2
3

I want to insert 3 blank lines between each of these, now that's got to be easy? You may have gathered I no Excel Expert.

Cheers All
PJ

 
Here's a "quick and dirty" macro to do what you want:
[blue]
Code:
Sub Insert3BlankLines()
Dim nRow As Long
Dim nRows As Long
  nRows = ActiveSheet.UsedRange.Rows.Count
  For nRow = 2 To nRows * 4 Step 4
    Cells(nRow, 1).EntireRow.Insert
    Cells(nRow, 1).EntireRow.Insert
    Cells(nRow, 1).EntireRow.Insert
  Next nRow
End Sub
[/color]

 
Here this should do the trick

Sub Insert()

Dim i As Integer
'
i = ActiveSheet.UsedRange.Row - 1 + _
ActiveSheet.UsedRange.Rows.Count

For i = 1 To i
ActiveCell.Offset(1, 0).Rows("1:1").EntireRow.Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
ActiveCell.Offset(3, 0).Range("A1").Select
Next
End Sub
 
Superb! Both did exactly what I wanted, once I worked out how to run a Macro that is!

You've saved me hours.

Thanks
PJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top