Qlik Community

Ask a Question

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikView forum consolidation is complete. Labels are now required. LEARN ABOUT LABELS
cancel
Showing results for 
Search instead for 
Did you mean: 
MindaugasBacius
Partner
Partner

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
tresesco
MVP
MVP

Try like:

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

MindaugasBacius
Partner
Partner

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