Hallo,
...ah ja, Du befindest dich jetzt in einem Workbook-Event, da mußt Du explizit auf das jeweilige Sh-Objekt referenzieren:
Option Explicit ' Variablendefinition erforderlich
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
'***********************************************
'* H. Ziplies *
'* 07.11.12 *
'* erstellt von HajoZiplies@web.de *
'* http://Hajo-Excel.de/ *
'***********************************************
' Fülfarbe
' für Schrift RaZelle.Font.ColorIndex
Dim RaBereich As Range ' Variable für Bereich
Dim RaZelle As Range ' Variable für Zelle
If Sh Is Worksheets("Überblick") Then '// hier ggF. für weitere TabBlätter anpassen..
Set RaBereich = Sh.Range("B6:CO22") ' Bereich der Wirksamkeit
Set RaBereich = Intersect(RaBereich, Target)
If Not RaBereich Is Nothing Then
For Each RaZelle In RaBereich
With RaZelle
Select Case UCase(RaZelle.Value) ' Umwandlung der Eingabe in Großbuchstaben
Case "W"
.Interior.Color = Sh.Cells(6, 3).Interior.Color
.Font.Color = Sh.Cells(6, 3).Font.Color
.Value = Sh.Cells(6, 3).Value
Case "S"
.Interior.Color = Sh.Cells(6, 6).Interior.Color
.Font.Color = Sh.Cells(6, 6).Font.Color
.Value = Sh.Cells(6, 6).Value
Case "F"
.Interior.Color = Sh.Cells(6, 9).Interior.Color
.Font.Color = Sh.Cells(6, 9).Font.Color
.Value = Sh.Cells(6, 9).Value
Case "BR"
.Interior.Color = Sh.Cells(6, 12).Interior.Color
.Font.Color = Sh.Cells(6, 12).Font.Color
.Value = Sh.Cells(6, 12).Value
Case "U"
.Interior.Color = Sh.Cells(6, 15).Interior.Color
.Font.Color = Sh.Cells(6, 15).Font.Color
.Value = Sh.Cells(6, 15).Value
Case "Z"
.Interior.Color = Sh.Cells(6, 18).Interior.Color
.Font.Color = Sh.Cells(6, 18).Font.Color
.Value = Sh.Cells(6, 18).Value
Case "B"
.Interior.Color = Sh.Cells(6, 21).Interior.Color
.Font.Color = Sh.Cells(6, 21).Font.Color
.Value = Sh.Cells(6, 21).Value
Case "L"
.Interior.Color = Sh.Cells(6, 24).Interior.Color
.Font.Color = Sh.Cells(6, 24).Font.Color
.Value = Sh.Cells(6, 24).Value
Case "SO"
.Interior.Color = Sh.Cells(6, 27).Interior.Color
.Font.Color = Sh.Cells(6, 27).Font.Color
.Value = Sh.Cells(6, 27).Value
Case Else
.Interior.ColorIndex = xlNone
.Font.ColorIndex = xlAutomatic
.NumberFormat = "General"
End Select
End With
Next RaZelle
End If
Set RaBereich = Nothing ' Variable leeren
End If
End Sub
Gruß,
|