wer wäre mir bitte behilflich: Habe in Spalte 6 und im Bereich Spalte 15 bis 76 (dynamisch)Kriterien für bed. Formatierung. In Spalte 6 (3 Kriterien) immer, im Bereich 17-76 in jeder 2. Spalte evtl. eine Eingabe "X". Beide müssen zutreffen.
Bekomme die Zeilen der Bedingungen nicht hin. Habe mit Formula und Local versucht. Was ist verkehrt? Wer könnte mir das bitte korrigieren?
' Bereich = definierter Name =BEREICH.VERSCHIEBEN('1'!$B$2;;;ANZAHL2('1'!$B:$B);ANZAHL2('1'!$2:$2))
Sub Format1()
Application.Goto Reference:="=BEREICH.VERSCHIEBEN('1'!$B$2;;;ANZAHL2('1'!$B:$B);ANZAHL2('1'!$2:$2))"
Dim i As Long
For i = 1 To Cells(Rows.Count, 6).End(xlUp).Row 'letzte Zeile in Spalte F
'korrigieren If Cells(i, 6) Formula1:="=UND($F5=""2x/Woche"";P5=""X"")"" Then 'wenn in Spalte F und P diese Begriffe
With Selection.FormatConditions(1).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
With Rows(i).Borders(xlEdgeBottom) 'ganze Zeile (auch leere Zellen) gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
'korrigieren elseIf Cells(i, 6) Formula1:="=UND($F5=""1x/Woche"";P5=""X"")" Then 'wenn in Spalte F und P diese Begriffe
With Selection.FormatConditions(2).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
Selection.FormatConditions(2).Interior.ColorIndex = 5
With Rows(i).Borders(xlEdgeBottom) 'ganze Zeile gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
'korrigieren elseIf Cells(i, 6) Formula1:="=UND($F5=""1x/Monat"";P5=""X"")" Then 'wenn in Spalte F und P diese Begriffe
With Selection.FormatConditions(3).Font
.Bold = True
.Italic = False
.ColorIndex = 2
End With
Selection.FormatConditions(3).Interior.ColorIndex = 1
With Rows(i).Borders(xlEdgeBottom) 'ganze Zeile gepunkteter Unterstrich
.LineStyle = xlContinuous
.Weight = xlHairline
.ColorIndex = xlAutomatic
End With
Else
Rows(i).Borders(xlEdgeBottom).LineStyle = xlNone
End If
Next i
End Sub
Hilfe wäre prima. Danke!
Gruß
Horst