|
本帖最后由 zjdh 于 2012-8-1 10:49 编辑
Private Sub CommandButton4_Click() '按钮粘贴
On Error GoTo Err
Set S = Application.Intersect(Selection, Range("G:H"))
If Not S Is Nothing Then MsgBox "你选择的区域不得粘贴!": Exit Sub
Set S = Application.Intersect(Selection, Range("J:L"))
If Not S Is Nothing Then MsgBox "你选择的区域不得粘贴!": Exit Sub
Set S = Application.Intersect(Selection, Range("N:P"))
If Not S Is Nothing Then MsgBox "你选择的区域不得粘贴!": Exit Sub
Set S = Application.Intersect(Selection, Range("R:T"))
If Not S Is Nothing Then MsgBox "你选择的区域不得粘贴!": Exit Sub
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats: Exit Sub
Err:
If Application.CutCopyMode = False Then
MsgBox "您还没复制,或请重新复制。"
Else
MsgBox "如果粘贴整行或整列,请注意粘贴位置;" & Chr(10) & "另外,本命令在剪切模式下不可使用。"
End If
End Sub |
|