|
重写了,自己比对吧
- Sub 查询_客户明细()
- Dim arr, i&, j%, a(), n&
- Dim Sh As Worksheet, key$, t1 As Date, t2 As Date
- Set Sh = Sheets("客户查询")
- key = Sh.Range("C2"): t1 = Sh.Range("G2"): t2 = Sh.Range("J2")
- arr = Sheets("销售明细").Range("E4").CurrentRegion
- For i = 4 To UBound(arr)
- If arr(i, 19) = key And arr(i, 1) >= t1 And arr(i, 1) <= t2 Then
- n = n + 1: ReDim Preserve a(1 To 18, 1 To n)
- For j = 1 To 18
- a(j, n) = arr(i, j)
- Next
- End If
- Next
- Application.ScreenUpdating = False
- Sh.Range("B5:S10000").ClearContents
- Sh.Range("B5:S10000").Borders.LineStyle = xlNone
- If n > 0 Then
- With Sh.Range("B5").Resize(n, 18)
- .Borders.LineStyle = xlContinuous
- .Value = WorksheetFunction.Transpose(a)
- End With
- Else
- MsgBox "没有找到相应数据!"
- End If
- Application.ScreenUpdating = True
- End Sub
- Sub 查询_销售单号()
- Dim arr, i&, j%, a(1 To 11, 1 To 8), n%, key$
- Sheets("单号查询").Select
- key = Range("O1")
- arr = Sheets("销售明细").Range("E4").CurrentRegion
- For i = 4 To UBound(arr)
- If arr(i, 2) = key Then
- n = n + 1
- a(1, n) = n
- For j = 4 To 13
- a(j - 2, n) = arr(i, j)
- Next
- End If
- Next
- i = i - 1
- [h14] = arr(i, 14)
- [g16] = arr(i, 15)
- [j16] = arr(i, 16)
- [L16] = arr(i, 17)
- [O16] = arr(i, 18)
- [g2] = arr(i, 19)
- Range("F5:P12") = WorksheetFunction.Transpose(a)
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|