|
试试这个
- Public Sub 出入库查询()
- Dim jieguo(1 To 1000000, 1 To 15)
- arr = Sheets("出入库明细").Range("a3").CurrentRegion
- If Sheets("出入库查询").Range("Q1") = "" Then a = "*" Else a = Sheets("出入库查询").Range("Q1")
- If Sheets("出入库查询").Range("Q2") = "" Then b = "*" Else b = Sheets("出入库查询").Range("Q2")
- If Sheets("出入库查询").Range("Q3") = "" Then c = "*" Else c = Sheets("出入库查询").Range("Q3")
- If Sheets("出入库查询").Range("T1") = "" Then d = "*" Else d = Sheets("出入库查询").Range("T1")
- If Sheets("出入库查询").Range("T2") = "" Then e = "*" Else e = Sheets("出入库查询").Range("T2")
- If Sheets("出入库查询").Range("T3") = "" Then f = "*" Else f = Sheets("出入库查询").Range("T3")
- If Sheets("出入库查询").Range("W1") = "" Then g = "*" Else g = Sheets("出入库查询").Range("W1")
- If Sheets("出入库查询").Range("W2") = "" Then h = "*" Else h = Sheets("出入库查询").Range("W2")
- If Sheets("出入库查询").Range("W3") = "" Then i = "*" Else i = Sheets("出入库查询").Range("W3")
- If Sheets("出入库查询").Range("Z1") = "" Then j = "*" Else j = Sheets("出入库查询").Range("Z1")
- If Sheets("出入库查询").Range("Z2") = "" Then k = "*" Else k = Sheets("出入库查询").Range("Z2")
- If Sheets("出入库查询").Range("Z3") = "" Then l = "*" Else l = Sheets("出入库查询").Range("Z3")
- If Sheets("出入库查询").Range("AC1") = "" Then P = "*" Else P = Sheets("出入库查询").Range("AC1")
- If Sheets("出入库查询").Range("AC2") = "" Then r = "*" Else r = Sheets("出入库查询").Range("AC2")
- If Sheets("出入库查询").Range("AC3") = "" Then v = "*" Else v = Sheets("出入库查询").Range("AC3")
-
-
-
- s = a & "@" & b & "@" & c & "@" & d & "@" & e & "@" & f & "@" & g & "@" & h & "@" & i & "@" & j & "@" & k & "@" & l & "@" & P & "@" & r & "@" & v
- Dim sDate, sd
- For i = 2 To UBound(arr)
- sss = arr(i, 6) & "@" & arr(i, 4) & "@" & arr(i, 11) & "@DATE11@" & arr(i, 13) & "@DATE13@" & arr(i, 2) & "@" & arr(i, 9) & "@" & arr(i, 2) & "@" & arr(i, 7) & "@" & arr(i, 5)
- If IsDate(arr(i, 11)) Then
- sd = "@" & Month(arr(i, 11)) & "@" & Int(1 + (Month(arr(i, 11)) - 1) / 3) & "@" & Year(arr(i, 11)) & "@"
- Else
- sd = "@*@*@*@"
- End If
- sss = Replace(sss, "@DATE11@", sd)
- If IsDate(arr(i, 13)) Then
- sd = "@" & Month(arr(i, 13)) & "@" & Int(1 + (Month(arr(i, 13)) - 1) / 3) & "@" & Year(arr(i, 13)) & "@"
- Else
- sd = "@*@*@*@"
- End If
- sss = Replace(sss, "@DATE13@", sd)
- If sss Like s Then
- n = n + 1
- For m = 1 To 15
- jieguo(n, m) = arr(i, m)
- Next
- End If
- Next
- Sheets("出入库查询").Rows("4:100000").ClearContents
- If n <> 0 Then
- Sheets("出入库查询").Range("a4").Resize(n, 15) = jieguo
- Else
- MsgBox "未检索到数据,请核实"
- End If
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|