Option
Explicit
Public
Sub
BTNAddLine()
If
Not
TypeOf
ActiveSheet
Is
Excel.Worksheet
Then
Call
MsgBox(
"'BTNAddLine'-Makro ist nur für Tabellenblätter bestimmt."
, vbExclamation)
Exit
Sub
End
If
Dim
vntResult
As
Variant
vntResult = Application.Caller
If
VarType(vntResult) <> vbString
Then
Exit
Sub
Set
vntResult = ActiveSheet.Shapes(vntResult)
If
vntResult.Type <> msoFormControl
Then
Exit
Sub
If
vntResult.FormControlType <> xlButtonControl
Then
Exit
Sub
Call
ActiveSheet.Range(
"A4:P4"
).Copy(vntResult.TopLeftCell)
vntResult.Top = vntResult.TopLeftCell.Offset(1).Top + (vntResult.Top - vntResult.TopLeftCell.Top)
End
Sub
Public
Sub
InitBTNAddLine()
If
Not
TypeOf
ActiveSheet
Is
Excel.Worksheet
Then
Call
MsgBox(
"'InitBTNAddLine'-Makro ist nur für Tabellenblätter bestimmt."
, vbExclamation)
Exit
Sub
End
If
Dim
vntResult
As
Variant
vntResult = Application.Caller
If
VarType(vntResult) <> vbString
Then
Exit
Sub
Set
vntResult = ActiveSheet.Shapes(vntResult)
If
vntResult.Type <> msoFormControl
Then
Exit
Sub
If
vntResult.FormControlType <> xlButtonControl
Then
Exit
Sub
With
ActiveSheet.Range(
"A4:P4"
).CurrentRegion
With
.Rows(.Rows.Count).Cells(1).Offset(1)
vntResult.Left = .Left + 0.15 * .Width
vntResult.Top = .Top + 0.5 * .Height
End
With
End
With
End
Sub