|
Private Sub CommandButton1_Click()
dh = ComboBox1.Text
If dh = "" Then MsgBox "请选择单号!": Exit Sub
Dim ar As Variant
Dim arr()
With Sheets("出库明细表")
mr = .Cells(Rows.Count, 3).End(xlUp).Row
ar = .Range("a2:o" & mr)
End With
ReDim arr(1 To UBound(ar), 1 To 9)
For i = 2 To UBound(ar)
If Trim(ar(i, 3)) = Trim(dh) Then
n = n + 1
arr(n, 1) = n
For j = 5 To 12
arr(n, j - 3) = ar(i, j)
Next j
mc = ar(i, 4)
dz = ar(i, 13)
rq = ar(i, 2)
lxr = ar(i, 14)
dhh = ar(i, 15)
End If
Next i
If n = "" Then MsgBox "没有符合条件的数据": Exit Sub
With Sheets("出库单")
.[a5:i14] = Empty
.[a5].Resize(n, UBound(arr, 2)) = arr
.[b2] = mc
.[b3] = dz
.[e2] = rq
.[e3] = lxr
.[h2] = dh
.[h3] = dhh
End With
MsgBox "ok!"
End Sub
|
评分
-
1
查看全部评分
-
|