nnsea 发表于 2023-9-19 15:46:21

excel插入行数VBA

Sub 弹出插入行()
    Dim i As Integer
    ws = InputBox("请插入多少行", "温馨提示")
    If ws = "" Then
      MsgBox "录入数据为空,程序结束执行。", , "温馨提示"
      Exit Sub
    End If
    For i = 1 To ws
      Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
    Next i
End Sub

页: [1]
查看完整版本: excel插入行数VBA