|
Sub 插入行()
n = InputBox("请输入你要插入的行数,只限小写数字", "插入行", "1")
For i = 1 To Sheets.Count
m = Mid(Sheets(i).Name, Len(Sheets(i).Name) - 3, 1)
x = Mid(ActiveSheet.Name, Len(ActiveSheet.Name) - 3, 1)
If m = x And Mid(Sheets(i).Name, 2, 1) = 1 Then
a = Sheets(i).Range("A65535").Rows.End(xlUp).Row - 2
Sheets(i).Rows(a & ":" & a + n).Insert Shift:=xlDown
Sheets(i).Range("A" & a - 1 & ":J" & a - 1).AutoFill Destination:=Sheets(i).Range("A" & a - 1 & ":J" & a + n), Type:=xlFillDefault
' Sheets(i).Range("A" & a & ":B" & a + n & ",D" & a & "" & a + n & ",F" & a & ":F" & a + n & ",H" & a & ":H" & a + n).ClearContents
End If
Next
End Sub |
|