VB - 插入空行

时间:2009-04-08 16:31:05

标签: excel vba

这对所有人来说都是孩子的游戏,但我根本不懂Visual Basic。如何编写语句以反复在Excel电子表格中的两行之间插入行?以下示例:

F-3757 - GROF FILTER REWORKLIJN
F-3758 - POEDERAFSCHEIDER
F-3759 - FIJNFILTER
F-3760 - STOFILTER
F-3762 - AANZUIGFILTER
B-3771 - VENTILATOR STORTKOKER

为:

F-3758 - POEDERAFSCHEIDER

F-3759 - FIJNFILTER

F-3760 - STOFILTER

F-3762 - AANZUIGFILTER

B-3771 - VENTILATOR STORTKOKER

1 个答案:

答案 0 :(得分:4)

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 

VBA Express显示了如何完成它的示例