Sub Kopieren()
Dim lngLetzte As Long
Dim intSpalte As Integer
With ActiveSheet.Shapes(Application.Caller)
intSpalte = Range(.TopLeftCell.Address).Column
lngLetzte = IIf(IsEmpty(Cells(Rows.Count, intSpalte)), _
Cells(Rows.Count, intSpalte).End(xlUp).Row, Rows.Count)
Range(Cells(3, intSpalte), Cells(lngLetzte, intSpalte)).Copy
Range("A3").PasteSpecial Paste:=xlValues
End With
Application.CutCopyMode = False
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim optButton As OptionButton
Dim intSpalte As Integer
If Target.Row > 2 And Target.Column < 6 Then
If Target.Count = 1 Then
For Each optButton In ActiveSheet.OptionButtons
If optButton.Value = 1 Then Exit For
Next optButton
intSpalte = optButton.TopLeftCell.Column
If intSpalte = Target.Column Then
Application.EnableEvents = False
Cells(Target.Row, 1) = Target
Application.EnableEvents = True
End If
Else
MsgBox "Bitte nur 1 Zelle ändern"
End If
End If
End Sub
Sub Kopieren()
Dim lngLetzte As Long
Dim intSpalte As Integer
With ActiveSheet.Shapes(Application.Caller)
intSpalte = Range(.TopLeftCell.Address).Column
lngLetzte = IIf(IsEmpty(Cells(Rows.Count, intSpalte)), _
Cells(Rows.Count, intSpalte).End(xlUp).Row, Rows.Count)
Range(Cells(3, intSpalte), Cells(lngLetzte, intSpalte)).Copy
Range("A3").PasteSpecial Paste:=xlValues
End With
Application.CutCopyMode = False
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Dim optButton As OptionButton
Dim intSpalte As Integer
If Target.Row > 2 And Target.Column < 6 Then
If Target.Count = 1 Then
For Each optButton In ActiveSheet.OptionButtons
If optButton.Value = 1 Then Exit For
Next optButton
intSpalte = optButton.TopLeftCell.Column
If intSpalte = Target.Column Then
Application.EnableEvents = False
Cells(Target.Row, 1) = Target
Application.EnableEvents = True
End If
Else
MsgBox "Bitte nur 1 Zelle ändern"
End If
End If
End Sub