Thanks for the suggestion Leith. Your code is interesting (I never learnt collections). I tried your code but it crashes Excel somewhere after 12,000 lines.

Also whenever the code encounters a folder that ends with a space (which Windows treats these as invalid see https://msdn.microsoft.com/en-au/lib...(v=vs.85).aspx ), VBA throws an Error 53. I added an error handler but it still crashes.