Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Discover how organizations are unlocking new revenue streams: Watch here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Small modification to a macro

Hi guys,

I have a macro which cycles through the contents of a field, which works great.

What I would like to do is cycle through the items in the list that meet a criteris in another, i.e. for this, only cycle through the 'names' which have a 'Y' in another column. These columns are connected in a table.

Is this possible? Code below.

Thanks!

Sub SelectNext

    set mySelections = ActiveDocument.fields("Name").GetSelectedValues(1)

    ActiveDocument.Fields("Name").Clear

    if mySelections.Count = 0 then

    set val=ActiveDocument.Fields("Name").GetPossibleValues(1)

    ValueToSelect = val.Item(0).Text

    else

  set val=ActiveDocument.Fields("Name").GetPossibleValues

  IamDone = " "

  for i=0 to val.Count-1

  ValueToSelect = val.Item(i).Text

  if IamDone = "X" then

  exit for

  end if

  if val.Item(i).Text = mySelections.Item(0).text then

  IamDone = "X"

  end if

  next 

   end if

   ActiveDocument.Fields("Name").Select ValueToSelect

End Sub

0 Replies