Excel宏在每行的单元格上使用Vlookup编译csv

时间:2014-08-26 10:07:57

标签: excel-vba vba excel

有谁知道为什么我的excel宏中的以下代码部分无法运行?

我正在从一行中的选定单元格生成CSV文件,其中一些需要在工作簿中查找已命名的范围

我试过的代码:

readingline = 4
Worksheets("Global").Select

While Not IsEmpty(Cells(readingline, 2)) And readingline <= 3000

        Outputline = "T" & "|" & _
            Application.VLookup(Cells(readingline, 12), Range("DOCTYP"), 2, False) & "|||" & _
            Application.VLookup(Cells(readingline, 2), Range("BPS"), 2, False) & "|" & _
            "C01" & "|" & "S01" & "|" & _
            Application.VLookup(Cells(readingline, 2), Range("BPS"), 2, False) & "|" & _
            "01012014" & "|" & _
            Application.VLookup(Cells(readingline, 6), Range("CUR"), 2, False) & "|" & _
            Format(Cells(readingline, 13), "DDMMYYYY") & "|" & _
            Application.VLookup(Cells(readingline, 2), Range("BPS"), 3, False) & "|" & _
            Cells(readingline, 11) & "|" & _
            Cells(readingline, 14)

        a.Writeline Outputline

0 个答案:

没有答案