Option
Explicit
Sub
KontextmenueErgaenzen()
Dim
oBtn
As
CommandBarButton
Dim
InI
As
Integer
For
InI = Application.CommandBars(
"Cell"
).Controls.Count
To
1
Step
-1
Application.CommandBars(
"Cell"
).Controls(1).Delete
Next
InI
For
InI = 1
To
25
Set
oBtn = Application.CommandBars(
"Cell"
).Controls.Add
With
oBtn
.Caption = Range(
"AbwK"
& InI).Value
.OnAction =
"'Färbe "
"AbwK"
& InI &
""
"'"
End
With
Next
End
Sub
Sub
Färbe(
ByVal
sBereich
As
String
)
With
ActiveCell
.Interior.Color = Application.Names(sBereich).RefersToRange.Interior.Color
.Value = Application.Names(sBereich).RefersToRange.Value
End
With
End
Sub