Since the first macro is already written, the second will work from the created sheet.
Sub TextFiles()
'Author: Jerry Beaucaire, ExcelForum.com
'Date: 10/14/2010
'Summary: Columns of data are saved to text files, name in cell 1, data below
Dim fPath As String: fPath = "C:\2010\"
Dim RNG As Range: Set RNG = ActiveSheet.Rows(1).SpecialCells(xlConstants)
Dim cell As Range
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each cell In RNG
Range(cell.Offset(1), Cells(Rows.Count, cell.Column)).SpecialCells(xlConstants).Copy
Sheets.Add
Range("A1").PasteSpecial xlPasteAll
ActiveSheet.Move
ActiveWorkbook.SaveAs fPath & cell.Text & ".txt", xlText
ActiveWorkbook.Close
Next cell
Application.ScreenUpdating = True
End Sub
Bookmarks