Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikWorld 2020: Join us May 11 - 14, 2020 in Phoenix, AZ. Register early and save $400. Learn More
Not applicable

For Next Loop VBA implemented in Qlikview

In this code what we are trying to attempt is to highlight all the 1's in a cell in green, and all the 0's in a cell in red. This works ok in Excel using the VBA macro, but when I transfer it to QlikView I get the error 'Expected end of Statement' at the 'Next x' line.

Any help would be appreciated!

Sub changeTextColor() 

    Dim v, clr, rng, x


    Set rng = Range("Verifier Concat")


    Do While rng.Value <> ""

        v = rng.Value 


        For x = 1 To Len(v)

            Select Case Mid(v, x, 1)

               Case "1": clr = RGB(0, 128, 0)

               Case "0": clr = RGB(255, 0, 0)

            End Select



            rng.Characters(x, 1).Font.Color = clr

            rng.Characters.Font.Bold = True


        Next x


        Set rng = rng.Offset(1, 0)


End Sub

Tags (3)
1 Reply
Honored Contributor II

Re: For Next Loop VBA implemented in Qlikview

VBS doesn't like the x. Just put Next.