Excel VBA 检查剪贴板是否为空
Excel VBA check if clipboard is empty
我写了一个 vba 脚本来在 excel sheet 中插入一定数量的新行。
代码完成了他的工作,除非剪贴板不为空。
是否有任何脚本可用于在执行此脚本之前清除剪贴板?
谢谢!
下面包含没有剪贴板检查的代码。
If ActiveSheet.Name <> "Worksheet A" Then
MsgBox "This macro only works in worksheet A"
Else
Dim Rng As Integer
Dim k As Integer
Dim R As Long
R = Selection.Row + 1
Rng = InputBox("Amount of rows?")
For k = 1 To Rng
Rows(R).Insert Shift:=xlDown
Next
End If
在你 运行 你的插入关闭之前 Application.CutCopyMode
:
If ActiveSheet.Name <> "Worksheet A" Then
MsgBox "This macro only works in worksheet A"
Else
Dim Rng As Integer
Dim k As Integer
Dim R As Long
R = Selection.Row + 1
Rng = InputBox("Amount of rows?")
Application.CutCopyMode = False
For k = 1 To Rng
Rows(R).Insert Shift:=xlDown
Next
End If
我写了一个 vba 脚本来在 excel sheet 中插入一定数量的新行。 代码完成了他的工作,除非剪贴板不为空。
是否有任何脚本可用于在执行此脚本之前清除剪贴板?
谢谢!
下面包含没有剪贴板检查的代码。
If ActiveSheet.Name <> "Worksheet A" Then
MsgBox "This macro only works in worksheet A"
Else
Dim Rng As Integer
Dim k As Integer
Dim R As Long
R = Selection.Row + 1
Rng = InputBox("Amount of rows?")
For k = 1 To Rng
Rows(R).Insert Shift:=xlDown
Next
End If
在你 运行 你的插入关闭之前 Application.CutCopyMode
:
If ActiveSheet.Name <> "Worksheet A" Then
MsgBox "This macro only works in worksheet A"
Else
Dim Rng As Integer
Dim k As Integer
Dim R As Long
R = Selection.Row + 1
Rng = InputBox("Amount of rows?")
Application.CutCopyMode = False
For k = 1 To Rng
Rows(R).Insert Shift:=xlDown
Next
End If