I'm kinda new using VBA so I'm having some problem to import multiple files in excel.

I have 186 txt files and I want to import from the second column of each file only strings that are not repeated. Each os these names would be in a column of other excel worksheet.

I was thinking of creating a macro for the first file and use a loop on that code.

Here is what I've done for one file:

Sub Macro1()
'
' Macro1 Macro
'

'
ChDir "C:\Users\User\Desktop\Dissertação de Mestrado\Dados\originais"
Workbooks.OpenText Filename:= _
"C:\Users\User\Desktop\Dissertação de Mestrado\Dados\originais\110101.text", _
Origin:=xlMSDOS, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=True, _
Comma:=False, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 9), _
Array(2, 1), Array(3, 9), Array(4, 9), Array(5, 9), Array(6, 9), Array(7, 9), Array(8, 9), _
Array(9, 9), Array(10, 9), Array(11, 9), Array(12, 9), Array(13, 9), Array(14, 9), Array(15 _
, 9), Array(16, 9), Array(17, 9), Array(18, 9), Array(19, 9), Array(20, 9), Array(21, 9), _
Array(22, 9), Array(23, 9)), TrailingMinusNumbers:=True
Columns("A:A").EntireColumn.AutoFit
Columns("A:A").Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
Range("A1").Select
Selection.AutoFilter
Range("A1:A41294").AdvancedFilter Action:=xlFilterCopy, CopyToRange:=Range( _
"B1"), Unique:=True
Columns("B:B").EntireColumn.AutoFit
Range("B1:B2").Select
Selection.Copy
Windows("Pasta1").Activate
ActiveSheet.Paste
Columns("A:A").EntireColumn.AutoFit
Range("A1").Select
End Sub

The files are in order. For example: "110101" , "110107", "110111"...