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:
Microsoft Certified Partners -
https://partner.microsoft.com/global/30000104Microsoft Advisory Services -
http://support.microsoft.com/gp/advisoryserviceFor more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site:
http://support.microsoft.com/default.aspx?scid=fh;EN-US;CNTACTMSSample Macro
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
Loop
End 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:
A1: 222
A2:
A3: 333
A4:
A5: 444
A6:
A7: 555
A8:
A9: 666
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.