Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
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)

    Loop

End Sub

1 Reply
m_woolf
Master II
Master II

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