我的代码不会迭代第一列

时间:2018-04-27 09:42:04

标签: excel vba excel-vba

以下代码不会迭代第一列。

With ThisWorkbook.Worksheets(1)
   For Line = 1 To .Cells(.Rows.Count, 1).End(xlUp).Row


       'Write Read-In Data into target data
        Print #1, Join(Application.Transpose(Application.Transpose(.Range(.Cells(Line, 2), .Cells(Line, .Columns.Count).End(xlToLeft)).Value)), "|")


    Next
    End With  

我不明白为什么

2 个答案:

答案 0 :(得分:0)

您正在迭代行。那不是:z3一个错字吗?我猜它应该是 x1 x2 x3 y1 y2 y3 z1 z2 z3 2 418 -5 -81 NaN NaN NaN 462 -24 NaN 5 415 -5 -116 487 -5 116 462 -24 NaN 7 413 -5 -81 NaN NaN NaN 462 -24 -111

答案 1 :(得分:0)

.Range(.Cells(Line, 2)< ---更改数字2并输入1