Excel: Help with if...then

I have code that will find and list subfolders, I need help writing an if...then...else statement that basically says if the subfolder is already listed, don't add it to list, if not, then add at end of list. I've tried all I could, but I don't think I'm putting it in the right place in the code, or something. Here is my code:

'Lists Folders '
    Dim row As Integer
    Dim SearchFolders As Variant
    row = 3
    LookInTheFolder = "I:\projects2\Koch\58MY8900\PROCESS\2013 Work (Phase 3)\DIH_Sulfolane\Equipment"
    Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
    For Each SearchFolders In FileSystemObject.GetFolder(LookInTheFolder).SubFolders
    Cells(row, 1) = Mid(SearchFolders, InStrRev(SearchFolders, "\") + 1)
    row = row + 1
    Next SearchFolders

This question generated 25 answers. To proceed to the answers, click here.

This thread is current as of November 27, 2013.

For more resources for Microsoft Excel