View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Trevor Shuttleworth Trevor Shuttleworth is offline
external usenet poster
 
Posts: 1,089
Default Dealing With Unique Items

Heath

I would approach this as follows:

use the FileScripting Object to list all the files in the folder(s) into
rows in a worksheet
use Text to Columns to separate out the file extension, .xls, etc
use Advanced Filter to copy unique extensions to another area
use CountIf to count the entries for each extension
use AutoFilter to select the extensions with a count = 1

Switch off ScreenUpdating to make the process quicker

Searching the Archives should give you lots of examples of listing files,
etc

Regards

Trevor


"Heath" wrote in message
...
I have been looking high and low for the answer to this, so any help is
appreciated.

I have thousands of files that I need to list just unique file types in
a sheet. I am trying to find a way to do this that is *very* fast.

What's making it so slow right now is that in order to make sure they
are unique I have to check the current file against every item of an
array array before I add it to the end of the array. This is fast for a
few files, but after 2000 it starts to get to be a bit slow.

One idea I had is if there is a way to create a class that only allows
unique items, but I am not sure how that would work. Does anyone know if
there is a setting for that, besides just going through each item and
checking it.

Basically if I could put in my code

On Error Goto Next

oMyFile.add file.type

that would generate an error and move along, thereby avoiding the need
to go through everything.

Or if anyone has another idea, I am all ears (and eyes)

Heath