Hallo,
dann mal zwei Varianten, dies erste für ActiveX-Controls, die zweite für Formularsteuerelemente, Code wie bez. einfügen:
' **********************************************************************
' Modul: Tabelle1(Störmeldung) Typ: Klassenmodul des Tabellenblattes
' **********************************************************************
Option Explicit
Private Sub CheckBox1_Click()
Dim objOLEObject As OLEObject
For Each objOLEObject In Worksheets("Layout").OLEObjects
With objOLEObject
If .progID = "Forms.TextBox.1" Then
With .Object
If Val(.Text) = Cells(8, 4).Value Then
.BackColor = IIf(CheckBox1.Value, vbRed, vbYellow)
Exit For
End If
End With
End If
End With
Next
Set objOLEObject = Nothing
End Sub
' **********************************************************************
' Modul: Modul1 Typ: Standardmodul
' **********************************************************************
Option Explicit
Public Sub CheckBox1_Click()
Dim objTextBox As Excel.TextBox
For Each objTextBox In Worksheets("Layout").TextBoxes
With ActiveSheet
If Val(objTextBox.Text) = .Cells(8, 4).Value Then
objTextBox.Interior.Color = IIf(.CheckBoxes(Application.Caller).Value = xlOn, vbRed, vbYellow)
Exit For
End If
End With
Next
Set objTextBox = Nothing
End Sub
Gruß,
|