Hello,
I am having trouble adding "text to columns" language to a macro I already built. I have built the following macro that allows me to pull in multiple text files into excel:
Sub GetSheets()
Path = "H:\Test\"
Filename = Dir(Path & "*.txt")
Do While Filename <> ""
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True
ActiveWorkbook.Sheets(1).Copy After:=ThisWorkbook.Sheets(1)
Workbooks(Filename).Close
Filename = Dir()
Loop
End Sub
The only problem is that the text file is importing in one string and not allowing me to perform a search. I would like to build code into my macro so it will automatically apply "text to columns" while the file is populating. The files are all different sizes but here is a sample of what I received from my recording:
Sub Macro4()
Selection.TextToColumns Destination:=Range("A1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 1), TrailingMinusNumbers:=True
End Sub
Any help is greatly appreciated! Thank you!
Bookmarks