|
楼主 |
发表于 2019-7-25 18:11
|
显示全部楼层
本帖最后由 ais9009 于 2019-7-25 18:22 编辑
Public Sub 不连续粘贴()
Application.ScreenUpdating = False
s = Selection.Count
ReDim arr(s - 1)
For Each Rng In Selection
arr(i) = Rng.Address
i = i + 1
Next
Range("xfd1").PasteSpecial (xlPasteAll)
For i = 0 To s - 1
Range("xfd1").Offset(i, 0).Cut
Range(arr(i)).Select
ActiveSheet.Paste
Next i
Application.ScreenUpdating = True
End Sub
Public Sub 不连续粘贴值()
Set MyData = New DataObject
Application.ScreenUpdating = False
MyData.GetFromClipboard
arr = Split(MyData.GetText(1), Chr(13) + Chr(10))
i = 0
For Each Rng In Selection
Rng.Value = arr(i)
i = i + 1
Next
Set MyData = Nothing
Application.ScreenUpdating = True
End Sub
我在Workbook_Open()里定义了两个快捷键CTRL+SHIFT+V和CTRL+SHIFT+N如下
Private Sub Workbook_Open()
Application.OnKey "^+{v}", "不连续粘贴"
Application.OnKey "^+{n}", "不连续粘贴值"
End Sub这个能改吗
|
|