用excel 宏为xls文件添加行

上一篇 / 下一篇  2011-04-12 09:49:19 / 个人分类:QTP技术

1、先录宏
2、修改宏脚本为:
Sub addline()
Dim i As Long
Dim a As Long

For i = 1 To 100
a = 101 - i '
    Rows(a).Select
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
  Next
End Sub

运行宏,这样就会把excel文件从1-100行中间各添加3行


TAG:

 

评分:0

我来说两句

Open Toolbar