|
请问老师,如何破解行数限制?代码如下
Sub 单机()
Dim wb As Workbook
Application.ScreenUpdating = False
Set wb = Workbooks.Open(ThisWorkbook.Path & "\记录.xlsm", Password:="123", UpdateLinks:=False)
With ThisWorkbook.Worksheets("辅料")
On Error Resume Next
For I = 2 To wb.Worksheets("辅料使用记录").Range("A1048576").End(xlUp).Row
If wb.Worksheets("辅料使用记录").Range("C" & I).Value = .[a1].Value And wb.Worksheets("辅料使用记录").Range("I" & I).Value & "" = .[b1].Value Then
.Range("A5").Resize(11, 8) = wb.Worksheets("辅料使用记录").Range("b" & I).Resize(11, 8).Value
Exit For
End If
Next I
For m = 2 To wb.Worksheets("添加剂使用记录").Range("A1048576").End(xlUp).Row
If wb.Worksheets("添加剂使用记录").Range("C" & m).Value = .[a1].Value And wb.Worksheets("添加剂使用记录").Range("I" & m).Value & "" = .[b1].Value Then
.Range("A18").Resize(11, 8) = wb.Worksheets("添加剂使用记录").Range("b" & m).Resize(11, 8).Value
Exit For
End If
Next m
End With
wb.Close False
Set wb = Nothing '释放内存
Application.ScreenUpdating = True
End Sub
|
|