|
昨晚写好没测试,再试试这个看看- Sub 成品入库()
- Dim rowC%, arr, brr, endrow%
- rowC = Sheet1.Range("C" & Rows.Count).End(xlUp).Row
- endrow = Sheet30.Range("C" & Rows.Count).End(xlUp).Row
- arr = Sheet1.Range("A5:X" & rowC)
- brr = Sheet30.Range("A6:P" & endrow)
- Dim i%, j%, str As String
- For j = 1 To UBound(brr)
- For i = 1 To UBound(arr)
- If brr(j, 3) = arr(i, 3) And brr(j, 4) = arr(i, 8) Then
- With Sheet1
- .Cells(i + 4, "X") = arr(i, 24) + brr(j, 16)
- If .Cells(i + 4, "X").Comment Is Nothing Then
- .Cells(i + 4, "X").AddComment
- .Cells(i + 4, "X").Comment.Text Text:=brr(j, 15) & "入库" & brr(j, 16) & "台;"
- Else
- str = .Cells(i + 4, "X").Comment.Text
- .Cells(i + 4, "X").ClearComments
- .Cells(i + 4, "X").Comment.Text Text:=str & Chr(10) & brr(j, 15) & "入库" & brr(j, 16) & "台;"
- End If
- If arr(i, 20) = Empty Then .Cells(i + 4, "I") = brr(j, 9)
- If arr(i, 23) = Empty Then .Cells(i + 4, "W") = brr(j, 15)
- End With
- End If
- Next i
- Next j
- MsgBox "成品入库成功。"
- End Sub
复制代码 |
评分
-
2
查看全部评分
-
|