This article was previously published under Q213318
In Microsoft Excel 2000, you can use a Microsoft Visual Basic for Applications macro to programmatically insert a blank row between every row of data on your worksheet. The example in this article contains a sample macro that performs this task.
Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or Microsoft Advisory Services. For more information, visit these Microsoft Web sites:
To insert a blank row between every row of data, follow these steps:
Start Excel 2000, and then create the following worksheet:
A1: 222 A2: 333 A3: 444 A4: 555 A5: 666
Press ALT+F11 to start the Visual Basic Editor.
On the Insert menu, click Module.
In the module sheet, type or paste the following code:
Sub Insert_Blank_Rows() 'Select last row in worksheet. Selection.end(xldown).select Do Until ActiveCell.row = 1 'Insert blank row. ActiveCell.EntireRow.Insert shift := xldown 'Move up one row. ActiveCell.Offset(-1,0).Select LoopEnd Sub
Press ALT+F11 to return to Excel.
Select cell A1 or any cell that contains data.
Press ALT+F8 to open the Macro dialog box.
In the Macro name list, click Insert_Blank_Rows, and then click Run.The macro returns the following values:
NOTE: If you select a blank cell, Excel places a blank between all 65,000 possible rows on the worksheet. If this happens, press ESC to stop the macro, and then select any cell with data in it and repeat step 7.