|
Sub InSertRows_1()
Dim i As Integer
Dim M As Integer
Dim A As Integer
A = InputBox("请输入你要隔多少行?", "行数值")
B = InputBox("请输入你插入多少行?", "行数值")
For M = A + 1 To 60 Step A + B
For i = 1 To B
Sheet1.Rows(M).Insert
Next i
Next M
End Sub
Sub aa()
On Error Resume Next
Application.CommandBars("CELL").Controls("插入行").Delete
Dim cd As CommandBarButton
Set cd = Application.CommandBars("CELL").Controls.Add(Type:=msoControlButton, BEFORE:=1)
With cd
.Caption = "插入行"
.FaceId = 609
.OnAction = "InSertRows_1"
End With
End Sub
Private Sub Workbook_BeforeClose(Cancel As Boolean)
On Error Resume Next
Application.CommandBars("CELL").Controls("插入行").Delete
End Sub
Private Sub Workbook_Open()
Call aa
End Sub |
|