AW: Ist es Möglich nur Werte auszuschneiden?
06.12.2009 21:23:52
Josef
Hallo Alex,
das würde ich so lösen.
' **********************************************************************
' Modul: DieseArbeitsmappe Typ: Element der Mappe(Sheet, Workbook, ...)
' **********************************************************************
Option Explicit
Private Sub Workbook_Activate()
Application.OnKey "^c", "'copyData ""copy""'"
Application.OnKey "^x", "'copyData ""cut""'"
Application.OnKey "^v", "'copyData ""insert""'"
End Sub
Private Sub Workbook_Deactivate()
Application.OnKey "^c"
Application.OnKey "^x"
Application.OnKey "^v"
End Sub
' **********************************************************************
' Modul: Modul1 Typ: Allgemeines Modul
' **********************************************************************
Option Explicit
Private varValues As Variant
Sub copyData(Optional mode As String)
On Error GoTo ErrExit
If TypeName(Selection) = "Range" Then
If mode = "copy" Then
varValues = Selection
ElseIf mode = "cut" Then
varValues = Selection
Selection.ClearContents
ElseIf mode = "insert" Then
If IsArray(varValues) Then
ActiveCell.Resize(UBound(varValues, 1), UBound(varValues, 2)) = varValues
ElseIf varValues <> "" Then
ActiveCell = varValues
End If
End If
End If
ErrExit:
If Err.Number <> 0 Then
MsgBox "Kopieren/Einfügen der Daten nicht möglich!", vbExclamation, "Kopieren/Einfügen"
End If
End Sub
Gruß Sepp