Option
Explicit
Public
Sub
OnButtonAction_PlusMinus()
If
VarType(Application.Caller) <> vbString
Then
Exit
Sub
End
If
Dim
shpButton
As
Excel.Shape
On
Error
Resume
Next
Set
shpButton = ActiveSheet.Shapes(Application.Caller)
On
Error
GoTo
0
If
shpButton
Is
Nothing
Then
Exit
Sub
End
If
If
shpButton.Type <> msoFormControl
Then
Exit
Sub
End
If
If
shpButton.FormControlType <> xlButtonControl
Then
Exit
Sub
End
If
Dim
rngCellAnchor
As
Excel.Range
Dim
number
As
Double
Set
rngCellAnchor = shpButton.TopLeftCell
If
IsNumeric(rngCellAnchor.Value)
Then
number = Application.InputBox(
"Wert eingeben:"
,
Default
:=1, Type:=1)
Select
Case
shpButton.OLEFormat.
Object
.Caption
Case
"+"
rngCellAnchor.Value = rngCellAnchor.Value + number
Case
"-"
rngCellAnchor.Value = rngCellAnchor.Value - number
End
Select
End
If
End
Sub