Hi guys I would appreciate help with VBA code to create many text files named out of cells in a column within an excel sheet. Any ideas?
Printable View
Hi guys I would appreciate help with VBA code to create many text files named out of cells in a column within an excel sheet. Any ideas?
Hello
Can you give more details please?
Try this code
Code:Sub Test()
Dim fso As Object, txtFil As Object, c As Range
Set fso = CreateObject("Scripting.FileSystemObject")
For Each c In Range("A1:A3")
Set txtFil = fso.CreateTextFile(ThisWorkbook.Path & "\" & c.Value & ".txt", True)
txtFil.Close
Next c
End Sub
The new created text files will be in the same path of your workbook (ThisWorkbook.Path) >> you can change to your folder like that ("C:\MyFolder")
You're welcome. Glad I can offer some help