Sub EXCEL内容复制文档()
Dim lStartRow As Long
Dim lEndRow As Long
Dim lRow As Long
Dim lCount As Long
Dim Arr
Dim str As String
Dim objFSO As Object
Dim objText As Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
lStartRow = 1
lEndRow = Range("B65536").End(xlUp).Row
Arr = Range("B" & lStartRow & ":B" & lEndRow)
lCount = 0
For lRow = lStartRow To lEndRow
If (lRow - lStartRow) Mod 200 = 0 Then
lCount = lCount + 1
If Not objText Is Nothing Then objText.Close
Set objText = objFSO.CreateTextFile("E:\测试" & lCount & ".txt")
End If
objText.WriteLine Arr(lRow, 1)
Next
lEndRow = Range("D65536").End(xlUp).Row
Arr = Range("D" & lStartRow & ":D" & lEndRow)
For lRow = lStartRow To lEndRow
If (lRow - lStartRow) Mod 200 = 0 Then
lCount = lCount + 1
If Not objText Is Nothing Then objText.Close
Set objText = objFSO.CreateTextFile("E:\测试" & lCount & ".txt")
End If
objText.WriteLine Arr(lRow, 1)
Next
lEndRow = Range("S65536").End(xlUp).Row
Arr = Range("S" & lStartRow & ":S" & lEndRow)
For lRow = lStartRow To lEndRow
If (lRow - lStartRow) Mod 200 = 0 Then
lCount = lCount + 1
If Not objText Is Nothing Then objText.Close
Set objText = objFSO.CreateTextFile("E:\测试" & lCount & ".txt")
End If
objText.WriteLine Arr(lRow, 1)
Next
objText.Close
Set Arr = Nothing
Set objText = Nothing
Set objFSO = Nothing
End Sub
追问有没有办法将B\D\S列 都放在一个TEXT文档里?
追答可以,但是你的问题是200行创建一个txt文档。