-1

谁能看到这个脚本有什么问题?

Option Explicit
Dim lrow As Long
Dim lcol As Long
Dim i As Long
Dim j As Long
Dim strow As Long
Dim fso As Object
Dim xl As Excel.Application
Dim wb As Object
Dim ws As Object
Dim f As Object
Dim Val As Object

Sub arrange_data()

Set fso = CreateObject("Scripting.FileSystemObject")

Set xl = CreateObject("Excel.Application")
Set wb = xl.Workbooks.Add
Set ws = wb.Sheets(1)

Set f = fso.OpenTextfile("<path to destination>\gg3-xtra.csv")

i = 1
j = 1

Do Until f.AtEndOfStream
Val = f.ReadLine
  If Val = "" Then
    i = 1
    j = j + 1
  Else
    ws.Cells(i, j).Value = Val
    i = i + 1
  End If
Loop

f.Close
wb.SaveAs "output.xls"
End Sub

我希望此脚本执行以下操作

数据集现在的样子

数据集1

…</p>

…</p>

数据集2

..

..

数据集3

脚本应该使它看起来像什么

Dataset1           Dataset2           Dataset3

...                     …                     …

…                     …                     …

…                     …                     …
4

1 回答 1

0

从您所显示的内容来看,如果您的 csv 文件没有空行,它似乎Val永远不会相等。""您的 csv 文件在数据集之间是否有任何空白行?

于 2013-04-30T21:15:32.577 回答