Removing Row of Listbox un startup

  1. 2 weeks ago

    Hi,
    I have data,

    AS01
    BS01
    AS02
    AS03
    BS01
    BS01
    BS01
    AS04
    CS01
    CS02
    CS03

    I want to duplicate the Listbox3 into Listbox6, and remove the row which is matched.

    I put this code on window1.open

      'Duplicate Listbox
      Dim numrows, numcols As Int32
      Dim r, c As Int32
      numrows = listbox3.listcount - 1
      numcols = MIN(listbox3.columncount , listbox6.columncount) -1
      
      listbox6.deleteallrows
      For r = 0 to numrows
        listbox6.addrow ""
        For c = 0 to numcols
          listbox6.cell(r, c) = listbox3.cell(r, c)
        Next c
      Next r
      
      
      
      dim o as Integer
      for o=0 to Listbox6.Listcount -1
        dim dd as string
        dd=Listbox6.cell(o,0).Left(2)
        If dd="AS" or dd="CS"then
          Listbox6.removeRow o ' remove every row with criteria
        end if
      next

    its do removing, but not all. I wanted to remove all the matches criteria.

    any helps ?

    Thanks

    Arief

  2. Stefan A

    is not verified Oct 11 Pre-Release Testers Austria, Tirol
    Edited 2 weeks ago by Stefan A

    Do the loop backwards:

    for o=Listbox6.Listcount -1 downto 0
    ...
    next
  3. Thanks,
    Its worked!

    Regards,
    Arief

or Sign Up to reply!