vba VB - 插入一个空行
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/730801/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 10:21:31 来源:igfitidea点击:
VB - Insert A Blank Row
提问by Erin Karschnik
This is child's play for all of you, but I don't know Visual Basic at all. How do I write a statement to insert a row between two rows in an Excel spreadsheet repeatedly? An example below:
这对你们所有人来说都是儿戏,但我根本不懂 Visual Basic。如何编写语句以在 Excel 电子表格的两行之间重复插入一行?下面是一个例子:
F-3757 - GROF FILTER REWORKLIJN
F-3758 - POEDERAFSCHEIDER
F-3759 - FIJNFILTER
F-3760 - STOFILTER
F-3762 - AANZUIGFILTER
B-3771 - VENTILATOR STORTKOKER
to:
到:
F-3758 - POEDERAFSCHEIDER
F-3759 - FIJNFILTER
F-3760 - STOFILTER
F-3762 - AANZUIGFILTER
B-3771 - VENTILATOR STORTKOKER
回答by TStamper
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 Expressshows an example how to accomplish it
VBA Express显示了如何完成它的示例