|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
猜的,不知道对不对
- Sub tt()
- Dim ar, br, i%, j%, s$, s2$
- With Sheets("发退货记录")
- ar = .Range("f1:ab" & .[f1].End(4).Row)
- End With
- With Sheets("销售记录")
- .Range("ac2:ac1048576") = ""
- br = .Range("f1:ac" & .[f1].End(4).Row)
- For i = 2 To UBound(br)
- s = br(i, 3) & br(i, 9) & br(i, 11)
- For j = 2 To UBound(ar)
- s2 = ar(j, 3) & ar(j, 9) & ar(j, 11)
- If s = s2 And ar(j, 23) > 0 Then
- If ar(j, 1) < br(i, 1) Then
- .Cells(i, "ac") = ar(j, 12)
- End If
- End If
- Next j
- Next i
- End With
- End Sub
复制代码 |
|