Sub 每一行保存为一个文本文件()
Dim Path As String
Dim yWb As Workbook
Dim xSh As Worksheet
Dim tRan As Range
Path = "E:\123\"
Set xSh = ActiveSheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each tRan In xSh.Range("A:A")
If tRan <> "" Then
Set yWb = Workbooks.Add
tRan.EntireRow.Copy yWb.Worksheets(1).Range("A1")
yWb.SaveAs Path & tRan.Row & ".txt", xlText
yWb.Saved = False
yWb.Close
Else
Exit For
End If
Next
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub
转载于:https://blog.51cto.com/gregdefanhua/1377030