1 Reply Latest reply: Jun 10, 2016 12:19 PM by m w RSS

    For Next Loop VBA implemented in Qlikview

    David Walsh

      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