Issue with compile syntax error with macro

时间:2015-06-15 15:10:29

标签: vba

I am trying to use this macro using 5 read only .csv files but get a compile error.

What am I doing wrong?

VBA - copy paste macro help needed

1 个答案:

答案 0 :(得分:0)

我编译了你的代码,它给出了一个关于未在以下行中声明的变量的错误:

.Sheets(1).Cells.Range("A2:C200").Copy wb.Sheets(1).Cells(2, 3 * x - 2)

应该是:

.Sheets(1).Cells.Range("A2:C200").Copy twb.Sheets(1).Cells(2, 3 * x - 2)