|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
代码不显示入库的数据,问题出在哪里?出库的数据显示
Private Sub cmd查询_Click()
Application.ScreenUpdating = False
Dim endrow As Long
Dim i As Long, j As Long
Dim dt1 As Date, dt2 As Date
'Dim QC
Dim daiMa As String
Dim ck As String
Dim r As Long, rr As Long
Dim firstline As Long
Dim flag As Boolean
Range("A5:P" & Rows.Count).ClearContents
Range("A5:P" & Rows.Count).Borders.LineStyle = xlNone
Range("A5:P" & Rows.Count).Font.ColorIndex = xlAutomatic
Range("A5:P" & Rows.Count).Interior.ColorIndex = xlAutomatic
dt1 = CDate(Me.txt开始日)
dt2 = CDate(Me.txt终了日)
Range("B2") = Me.TextBox1.Text
daiMa = Me.TextBox1.Text
Range("D2") = Me.TextBox2.Text
'Range("F2") = ck
Range("O2") = Format(dt1, "yyyy/m/d") & "~" & Format(dt2, "yyyy/m/d")
'*****************************************************************
Sheets("SanTem").Range("A3:P" & Rows.Count).ClearContents
Dim dRow As Long
dRow = Sheet23.Range("A" & Sheet23.Rows.Count).End(xlUp).Row
dRow = Sheet8.Range("A" & Sheet8.Rows.Count).End(xlUp).Row
Dim arr, brr(), err, frr()
arr = Sheet23.Range("A2:T" & dRow)
err = Sheet8.Range("A2:T" & dRow)
ReDim brr(1 To UBound(arr), 1 To 16)
ReDim frr(1 To UBound(err), 1 To 16)
Dim ShuHang, chuku As Long
ShuHang = UBound(arr)
chuku = UBound(err)
Dim m As Long
m = 0
If dRow > 1 Then
For j = 1 To ShuHang
For Z = 1 To chuku
' flag = True
' If ck = "" Then
' ElseIf ck <> Trim(CStr(arr(j, 10))) Then
' ElseIf ck <> Trim(CStr(err(z, 10))) Then
' flag = False
' End If
If (daiMa = UCase(Trim(CStr(arr(j, 11))))) And (CDate(Trim(CStr(arr(j, 3)))) <= dt2) Then
If (daiMa = UCase(Trim(CStr(err(Z, 11))))) And (CDate(Trim(CStr(err(Z, 3)))) <= dt2) Then
m = m + 1
brr(m, 1) = arr(j, 3) '日期
brr(m, 2) = arr(j, 6) '凭证号
brr(m, 3) = arr(j, 2) '出入类别
If arr(j, 2) = "出库" Then
brr(m, 7) = arr(j, 15) '数量
brr(m, 9) = arr(j, 16) '单价
brr(m, 10) = arr(j, 17) '金额
End If
frr(m, 1) = err(Z, 3) '日期
frr(m, 2) = err(Z, 6) '凭证号
frr(m, 3) = err(Z, 2) '出入类别
If err(Z, 2) = "入库" Then
frr(m, 7) = err(Z, 15) '数量
frr(m, 9) = err(Z, 16) '单价
frr(m, 10) = err(Z, 17) '金额
End If
End If
End If
Next Z
Next j
|
|