如果是n行和,弹出inputbox,怎么改写呢
追答Sub InsertColumnsAndRows()
Dim i As Long
Dim j As Long
Dim k As Long
Dim r As Long, c As Long
r = Abs(Int(Application.InputBox("输入增加的行数:", "增加行列", , , , , , 1)))
c = Abs(Int(Application.InputBox("输入增加的列数:", "增加行列", , , , , , 1)))
i = Selection.Range("A1").Row
j = Selection.Range("A1").Column
If r > 0 Then
For k = 1 To r
Cells(i, j).EntireRow.Insert
'Cells(i, j).EntireColumn.Insert
Next k
End If
If c > 0 Then
For k = 1 To c
'Cells(i, j).EntireRow.Insert
Cells(i, j).EntireColumn.Insert
Next k
End If
End Sub