|
本帖最后由 抹不去の回忆 于 2023-7-26 16:33 编辑
Sub 提取基础数据()
Sheet1.Range("a2:y65566").Clear
Dim arr, wb As Workbook
Set wb = CreateObject(ThisWorkbook.Path & "/总库存.xlsx")
arr = wb.Sheets("sheet1").Range("a1").CurrentRegion
wb.Close 0
Application.ScreenUpdating = False
Workbooks("自动报货表1.xlsm").Activate
brr = ActiveWorkbook.Sheets("采购计划表").Cells(1, 1).CurrentRegion.Row
Sheet1.Range("a:a").NumberFormatLocal = "@"
For i = 2 To UBound(arr)
brr(j, 1) = arr(i, 4)
brr(j, 2) = arr(i, 5)
brr(j, 3) = arr(i, 6)
brr(j, 4) = arr(i, 7)
brr(j, 5) = arr(i, 9)
'Sheet1.Cells(i, 9) = arr(i, 10)
Next
ActiveWorkbook.Sheets("采购计划表").Cells(1, 1).CurrentRegion.Row = brr
Erase arr, brr
Set wb = Nothing
End Sub
标红色部分的代码提示下标越界,请大神指导一下什么原因
|
|