Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

MindaugasBacius
Valued Contributor II

Macros. FormatConditions

Hei,

I am facing a problem. There is my part of the macro:

XLDoc.Sheets(1).Range("E2:E15").Select

SET cfColorScale = Selection.FormatConditions.AddColorScale.ColorScaleType(3)

cfColorScale.ColorScaleCriteria(1).FormatColor.Color = RGB(99, 190, 123)
cfColorScale.ColorScaleCriteria(2).FormatColor.Color = RGB(255, 235, 134)
cfColorScale.ColorScaleCriteria(3).FormatColor.Color = RGB(248, 105, 107)

There is the error:

Screenshot_1.jpg

What I am doing wrong and could you help my out?

Thank you!

2 Replies
MVP
MVP

Re: Macros. FormatConditions

Try like:

SET cfColorScale = XLDoc.Sheets(1).Range("E2:E15").FormatConditions.AddColorScale.ColorScaleType(3)

MindaugasBacius
Valued Contributor II

Re: Macros. FormatConditions

I've already tried this option unsuccessfully:

Screenshot_1.jpg

I've managed to come with correct script in VBA unfortunately in VBS it differs and I cannot come across the correct code:

Sub CreateColorScaleCF()

Range("B1:B10").Select

Set cfColorScale = Selection.FormatConditions.AddColorScale(ColorScaleType:=3)

cfColorScale.ColorScaleCriteria(1).FormatColor.Color = RGB(99, 190, 123)

cfColorScale.ColorScaleCriteria(2).FormatColor.Color = RGB(255, 235, 134)

cfColorScale.ColorScaleCriteria(3).FormatColor.Color = RGB(248, 105, 107)

End Sub