|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub Macro1()
On Error Resume Next
mc = [l2]
If mc = "" Then Exit Sub
m = Range("A" & Rows.Count).End(3).Row 'm = [a65536].End(3).Row
m1 = Sheet1.Range("A" & Rows.Count).End(3).Row 'Sheet1.[a65536].End(3).Row
arr = Sheet1.Range("a3:h" & m1)
Range("a4:l" & m).ClearContents
ReDim brr(1 To UBound(arr), 1 To 12)
lx = Array("返利金额", "优惠金额", "赔付金额", "坏账金额", "押金", "实收金额")
For i = 1 To UBound(arr)
If arr(i, 4) = mc Then
k = k + 1
brr(k, 1) = arr(i, 2)
brr(k, 2) = arr(i, 3)
w = Application.Match(arr(i, 5), lx, 0)
brr(k, 5 + w) = arr(i, 8)
End If
Next
Range("a4").Resize(k, 12) = brr
End Sub
以上代码突破65536行数限制。
|
|