ich möchte gerne 3 Commandbutton aus Zelleninhalten beschriften.
Mit einem Commandbutton klappt das.
Wie beziehe ich den 2. und 3. Butten mit ein
Die Namen für die Button stehen in den Zelle A2 und B1
Gruß
Stefan
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address "$A$1" Then Exit Sub
CommandButton1.Caption = Range("A1")
CommandButton2.Caption = Range("A2")
CommandButton3.Caption = Range("B1")
End Sub
So haut es leider nicht hin, wohl wegen dem if Target....
If Intersect(Target, Range("A1:A2,B1")) is nothing then Exit sub Then Exit Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A1:A2,B1")) is nothing then Exit sub Then Exit Sub
CommandButton1.Caption = Range("A1")
CommandButton2.Caption = Range("A2")
CommandButton3.Caption = Range("B1")
End Sub
GrußPrivate Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A2,B1")) Is Nothing Then
CommandButton1.Caption = Range("A1")
CommandButton2.Caption = Range("A2")
CommandButton3.Caption = Range("B1")
End If
End Sub
VBA/HTML-CodeConverter, AddIn für Office 2002-2016 - in VBA geschrieben von Lukas Mosimann. Projektbetreuung:RMH Software & Media
Code erstellt und getestet in Office 16 - mit VBAHTML 12.6.0
A | B | C | D | E | F | |
1 | Gruß Sepp | |||||
2 | ||||||
3 |