Attribute VB_Name = "Module1" Private Sub PoistaEhdollinenMuotoilu(ByVal SoluAlue As String) Range(SoluAlue).FormatConditions.Delete End Sub Private Sub LisaaDatabar(ByVal SoluAlue As String) With Range(SoluAlue) .FormatConditions.AddDatabar .FormatConditions(1).BarColor.Color = vbBlue .FormatConditions(1).ShowValue = True .FormatConditions(1).BarColor.TintAndShade = 0.5 End With End Sub Private Sub LisaaAboveAverage(ByVal SoluAlue As String) Range(SoluAlue).FormatConditions.AddAboveAverage Range(SoluAlue).FormatConditions(1).AboveBelow = xlAboveAverage Range(SoluAlue).FormatConditions(1).Interior.Color = vbRed End Sub Private Sub LisaaTop5(ByVal SoluAlue As String) Range(SoluAlue).FormatConditions.AddTop10 Range(SoluAlue).FormatConditions(1).TopBottom = xlTop10Top Range(SoluAlue).FormatConditions(1).Rank = 5 Range(SoluAlue).FormatConditions(1).Font.Color = -16383844 End Sub Private Sub LisaaEhdollinenMuotoiluExcel2003(ByVal SoluAlue As String) With Range(SoluAlue) .FormatConditions.Add Type:=xlCellValue, Operator:=xlGreater, Formula1:="200" .FormatConditions.Add Type:=xlCellValue, Operator:=xlLess, Formula1:="100" .FormatConditions(1).Font.ColorIndex = 43 .FormatConditions(2).Font.ColorIndex = 45 End With End Sub Sub LisaaIconset(ByVal SoluAlue As String) Range(SoluAlue).FormatConditions.AddIconSetCondition Range(SoluAlue).FormatConditions(1).IconSet = ActiveWorkbook.IconSets(xl5Quarters) 'Seuraavat komennot eivät ole pakollisia, näillä voi muuttaa oletusarvoista 20/40/60/80 jakaumaa Range(SoluAlue).FormatConditions(1).IconCriteria(2).Value = 45 Range(SoluAlue).FormatConditions(1).IconCriteria(3).Value = 60 Range(SoluAlue).FormatConditions(1).IconCriteria(4).Value = 75 Range(SoluAlue).FormatConditions(1).IconCriteria(5).Value = 90 End Sub Private Sub Suorita() PoistaEhdollinenMuotoilu ("A4:A18") 'LisaaDatabar "A4:A18" 'LisaaAboveAverage "A4:A18" 'LisaaTop5 "A4:A18" 'LisaaEhdollinenMuotoiluExcel2003 "A4:A18" LisaaIconset "A4:A18" End Sub