A
ajshap1
I have multiple rows within a worksheet and need them to automatically
save into a separate txt file.
Example:
I have a workbook with rows b-z. Instead of taking each of the rows
and copying and pasting it into another separate excel file, then
saving in a txt format, is there a way to automate this?
So that the following will occur:
Column B 950 line is one file
Column C 950 lines is another
column D lines in another txt file.....etc
I have some code listed below, however, it reads the first column cell
by cell. It does not group column by column grouping all data within
that column as on txt file
Thanks
Code:
Sub notebook_save()
Set wkbk = Workbooks.Add
Sheets("Sheet1").Select
RowCount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 1 To RowCount
Sheets("Sheet1").Select
Range("a" & i).Select
ActiveCell.EntireRow.Copy
Sheets("Sheet2").Select
Range("a1").Select
ActiveSheet.Paste
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs _
Filename:="c:\save" & i & ".txt", _
FileFormat:=xlTextMSDOS
wkbk.Close
Next
Application.DisplayAlerts = True
End Sub
save into a separate txt file.
Example:
I have a workbook with rows b-z. Instead of taking each of the rows
and copying and pasting it into another separate excel file, then
saving in a txt format, is there a way to automate this?
So that the following will occur:
Column B 950 line is one file
Column C 950 lines is another
column D lines in another txt file.....etc
I have some code listed below, however, it reads the first column cell
by cell. It does not group column by column grouping all data within
that column as on txt file
Thanks
Code:
Sub notebook_save()
Set wkbk = Workbooks.Add
Sheets("Sheet1").Select
RowCount = Cells(Cells.Rows.Count, "a").End(xlUp).Row
For i = 1 To RowCount
Sheets("Sheet1").Select
Range("a" & i).Select
ActiveCell.EntireRow.Copy
Sheets("Sheet2").Select
Range("a1").Select
ActiveSheet.Paste
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs _
Filename:="c:\save" & i & ".txt", _
FileFormat:=xlTextMSDOS
wkbk.Close
Next
Application.DisplayAlerts = True
End Sub