Na všech, listech mám volné tlačítko, které bylo kdysi spojeno s makrem co už nepoužívám. Takže jsem si vytvořil makro a na všech listech jsem jen proklikal tlačítko a mám to.
Makro sem si nahrál při prvním listu, asi nic moc, ale účel splnilo.
Cells.FormatConditions.Delete
Range("D6:G998").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$E6"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0
End With
Range("B6:C998").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=A($B6>0;$E6>0)"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent2
.TintAndShade = 0
End With
Range("D6:D998").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(D:D;D6)>1"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
Range("J6:J998").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
"=COUNTIF(D:D;J6)>0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 49407
.TintAndShade = 0
End With
Range("K6:K998").Select
Selection.FormatConditions.Add Type:=xlCellValue, Operator:=xlEqual, _
Formula1:="=$I$3"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 5287936
.TintAndShade = 0
End With
Range("I3:J3").Select
Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$L$3=0"
Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
With Selection.FormatConditions(1).Interior
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
End With
End Subcitovat