ich habe im Frame1, 24 Command Button's
Ich suche nach einem Befehl mit welchen ich bei allen Command's Backcolor auf einmal umstellen kann
danke
Option Explicit
Private Sub CMD_Liste1_Click()
'* H. Ziplies *
'* 13.01.11 *
'* erstellt von HajoZiplies@WEB.de *
'* http://Hajo-Excel.de
Dim ObCb As Object
For Each ObCb In UF_Datum.Fr_Mein.Controls
Select Case TypeName(ObCb)
Case "CommandButton"
MsgBox ObCb.Name
End Select
Next ObCb
End Sub
Zu Deiner Datei kann ich nichts schreiben, was wohl daran liegt das ich nicht auf fremde Rechner schaue.Ich baue keine Datei nach.Code:
[Cc]
Private Sub CommandButton4_Click()
Dim objControl As Control
For Each objControl In Frame1.Controls
If TypeOf objControl Is MSForms.CommandButton Then _
objControl.BackColor = vbRed
Next
End Sub
Den Namen des auslösenden CommandButtons musst du natürlich noch anpassen. Der Code gehrt in das Modul des UserForms.