habe aus dem Forum nachstehendes Makro, das ich anpassen möchte:
Option Explicit
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim gezogen As Range, zeile As Long, Zelle As Range, tip1 As Range
Dim tip2 As Range, tip3 As Range, tip4 As Range, tip5 As Range
Dim tip1und2 As Range
On Error Resume Next
If Target.Count > 1 Or Target.Row = 1 Or Target.Column <> 7 Then Exit Sub
gezogen.Interior.ColorIndex = xlNone
zeile = Target.Row
Set tip1 = Sheets("Ränge").Range("F2:F21")
Set tip2 = Sheets("gezZahlen").Range("B479:U479")
Set tip1und2 = Sheets("Ränge").Range("F2:F21") And Sheets("gezZahlen").Range("B479:U479")
Set gezogen = Range(Cells(zeile, 1), Cells(zeile, 5))
For Each Zelle In gezogen
If WorksheetFunction.CountIf(tip1, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = 38
If WorksheetFunction.CountIf(tip2, Zelle.Value) > 0 Then Zelle.Interior.ColorIndex = 6
' If WorksheetFunction.CountIf(tip1und2, Zelle.Value) = 1 Then Zelle.Interior.ColorIndex = 37
' If WorksheetFunction.CountIf(tip1und2, Zelle.Value) = 0 Then Zelle.Interior.ColorIndex = xlNone '2
Next
End Sub
Es soll erreicht werden, wenn eine Zahl sowohl in tip1 als auch in tip2 enthalten ist,
dass dann die Farbe "37" gefüllt wird und wenn in beiden tips die Zahl der
Zelle nicht zu finden ist, dann "entfäfben" =xlNone.
Leider funktionierts nicht, trotz diverser Änderungen.
Besten Dank für eine Hilfe!
mfg
Erich
EXCEL-Shareware und Freeware: http://www.toolex.de
Die Alternative zu Lotto ist KENO: http://www.kenostrategen.de