处于3万多数据,匹配SKU时一直显示溢出
python
Row_S = 4
'匹配值
With WLshtApp.xlapp.ActiveSheet
'ReDim arr_Result(1 To Row2 - Row1 + 1, 1 To .Range("G5").End(xlToRight).Column) '.Range("E5").End(xlToRight).Column)
arr_Result = .Range(.Cells(Row1, 8), .Cells(Row2, 100)).Formula
For i = Row1 To Row2
If .Cells(i, 1) = "合计" Then GoTo mExit
arr_Result_Count = arr_Result_Count + 1
If .Cells(i, 7) <> "" Then
For j = 8 To UBound(arr_Result, 2)
k = k + 1
If .Cells(Row_S, j) <> "" Then
TempStr = Dic(UCase(Trim(.Cells(2, j).MergeArea.Cells(1, 1)))) & "|" & UCase(Trim(.Cells(i, 7))) & "|" & Dic(UCase(Application.WorksheetFunction.Clean(Trim(.Cells(Row_S, j).Text))))
TempStr = Replace(Replace(TempStr, Chr(10), ""), Chr(13), "")
If Dic_Index.Exists(TempStr) = True Then
arr_Result(arr_Result_Count, k) = Dic_Index(TempStr)
If InStr(.Cells(Row_S, j), "数量") = 0 And InStr(.Cells(Row_S, j), "合计") = 0 Then Total = Total + arr_Result(arr_Result_Count, k)
Else
'arr_Result(arr_Result_Count, k) = 0
If InStr(.Cells(Row_S, j), "合计") > 0 Then arr_Result(arr_Result_Count, k) = Total: Total = 0
End If
If InStr(UCase(Trim(.Cells(2, j).MergeArea.Cells(1, 1))), "ADJUSTMENT") > 0 Then
TempStr = Dic(UCase(Trim(.Cells(2, j).MergeArea.Cells(1, 1))) & "_1") & "|" & UCase(Trim(.Cells(i, 7))) & "|" & Dic(UCase(Trim(.Cells(Row_S, j).Text))) & "|" & Dic(UCase(Trim(.Cells(2, j).MergeArea.Cells(1, 1))) & "_2")
TempStr = Replace(Replace(TempStr, Chr(10), ""), Chr(13), "")
If Dic_Index.Exists(TempStr) = True Then
arr_Result(arr_Result_Count, k) = Dic_Index(TempStr)
Else
'arr_Result(arr_Result_Count, k) = 0
End If
End If
'MsgBox Dic_Index("ORDINE|7T-IP CAMERA-DE|QUANTITà")
End If
Next
End If
k = 0
Total = 0
Next
mExit:
If arr_Result_Count > 0 Then .Cells(Row1, 8).Resize(arr_Result_Count, UBound(arr_Result, 2)) = arr_Result
If mType = 1 Then
If msgCount Mod 2 = 0 Then
MsgBox "已完成"
End If
End If
End With
Application.EnableEvents = True
msgCount = msgCount + 1
Exit Sub
mErrExit:
MsgBox Err.Description
Application.EnableEvents = True
End Sub
Sub yy()
Application.EnableEvents = True
End Sub
Sub Get_Rel(Dic As Dictionary, Country As String, Key1 As String, Key2 As String, Key3 As String)
Dim i As Integer
Dim mRow As Integer
'arr = Array("Quantità", "Vendite", "Accrediti per le spedizioni", "Accrediti per confezioni regalo", "Sconti promozionali", "Commissioni di vendita", "Costi del servizio Logistica di Amazon")
'brr = Array("销售数量", "product sales订单销售额", "shipping credits航运优惠", "gift wrap credits", "promotional rebates促销折扣", "Amazon佣金", "FBA Fee费用")
With WLshtApp.xlapp.Sheets(3)
For i = 4 To .Range("A65536").End(xlUp).Row
If .Cells(i, 1) = Country Then
Key1 = Replace(Replace(UCase(Trim(.Cells(i, 2))), Chr(10), ""), Chr(13), "")
Key2 = Replace(Replace(UCase(Trim(.Cells(i, 3))), Chr(10), ""), Chr(13), "")
Key3 = Replace(Replace(UCase(Trim(.Cells(i, 4))), Chr(10), ""), Chr(13), "")
mRow = i
Exit For
End If
Next
For i = 5 To .Range("IV" & mRow).End(xlToLeft).Column
Dic(Replace(Replace(UCase(Trim(.Cells(mRow, i).Text)), Chr(10), ""), Chr(13), "")) = Replace(Replace(UCase(Trim(.Cells(mRow + 1, i).Text)), Chr(10), ""), Chr(13), "")
Next
End With
End Sub
Sub Get_Dic_Title_Data(sh As Worksheet, KeyWord As String, Row_S As Integer, Dic_Title As Dictionary, arr As Variant)
Dim i As Integer
Dim LastCol As Integer
Dim LastRow As Integer
LastCol = sh.Range("IV" & Row_S).End(xlToLeft).Column
arr = sh.Range(sh.Cells(Row_S, 1), sh.Cells(Row_S, LastCol))
For i = 1 To UBound(arr, 2)
If arr(1, i) <> "" Then
Dic_Title(UCase(arr(1, i))) = i
End If
Next
LastRow = sh.Cells(65536, Dic_Title(KeyWord)).End(xlUp).Row
arr = sh.Range(sh.Cells(Row_S + 1, 1), sh.Cells(LastRow, LastCol))
End Sub