Gruppe
Allgemein
Problem
Wie kann ich die Werte und Zahlenformate zweiter ausgewählter Zellen tauschen?
StandardModule: basMain
Sub Zelltausch()
Dim vValue As Variant
Dim sFormat As String
If Selection.Cells.Count <> 2 Then
Beep
MsgBox "Sie müssen 2 Zellen auswählen!"
Exit Sub
End If
With Selection
vValue = .Cells(1).Value
sFormat = .Cells(1).NumberFormat
.Cells(1) = Selection.Cells(2).Value
.Cells(1).NumberFormat = Selection.Cells(2).NumberFormat
.Cells(2).Value = vValue
.Cells(2).NumberFormat = sFormat
End With
End Sub