代码如下:
Sub 数据复制()
Dim i As Long
Dim j As Long
Dim y0 As Long
Dim y1 As Long
ColumsMax = ActiveSheet.Range("A1").CurrentRegion.Rows.Count '获取当前数据区域最大行号
For i = 2 To 8
If Len(Cells(i, 11)) <> 0 Then
y0 = Range(Cells(i, 15), Cells(i, 44)).Find(Cells(i, 11)).Column '获得内部工序对应该工单工序中的列号
y0 = y0 + 1
For j = y0 To 100
_ y1 = Range(Cells(1, 47), Cells(1, 80)).Find(Cells(i, j)).Column__ '获得内部工序在对应工序中的列号
Cells(i, y1) = Cells(i, 7).Value
Next
End If
Next
End Sub
错误代码如下图所示:请帮忙指出错误点的解决方法!
用debug.print(j) 调试一下看看j的值超不超范围