title: Deleting directory in an array
body: <p>I have this code that gets all file types.</p>
  
  <pre><code>Dim file as variant
  file = Application.GetOpenFilename("All Files, *.*", , "Select File", , True)
  </code></pre>
  
  <p>Then I have to print it in the cells on a sheet.</p>
  
  <pre><code>For i = 1 To UBound(file)
      lRow = Cells(Rows.count, 15).End(xlUp).Row
      lRow = lRow + 1
  
      ThisWorkbook.Sheets("Main").Range("O" &amp; lRow).Value = CStr(file(i))
  Next i
  </code></pre>
  
  <p>but what I want is first check the contents of the array. If the array has this file type, then I have to remove it in the arraylist. After that, a message will pop out that this files are removed.</p>
  
  <pre><code>dim arr() as string
  arr = Split("ade|adp|app|asp|bas|bat|cer|chm|cmd|com|cpl|crt|csh|der|exe|fxp|gadget|hlp|hta|inf|ins|isp|its|js|jse|" _
  &amp; "ksh|lnk|mad|maf|mag|mam|maq|mar|mas|mat|mau|mav|maw|mda|mdb|mde|mdt|mdw|mdz|msc|msh|msh1|msh2|" _
  &amp; "mshxml|msh1xml|msh2xml|ade|adp|app|asp|bas|bat|cer|chm|cmd|com|cpl|crt|csh|der|exe|fxp|gadget|hlp|" _
  &amp; "hta|msi|msp|mst|ops|pcd|pif|plg|prf|prg|pst|reg|scf|scr|sct|shb|shs|ps1|ps1xml|ps2|ps2xml|psc1|psc2|tmp|url|vb|vbe|vbs|vsmacros|vsw|ws|wsc|wsf|wsh|xnk", "|")
  </code></pre>
  
  <p>I just don't know where I have to start. I have found a little bit same problem <a href="https://stackoverflow.com/questions/7000334/deleting-elements-in-an-array-if-element-is-a-certain-value-vba">here in this post</a>, but I just can't understand it. Thanks!</p>