- ©«¤l
- 4901
- ¥DÃD
- 44
- ºëµØ
- 24
- ¿n¤À
- 4916
- ÂI¦W
- 246
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Office 20xx
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥x¥_
- µù¥U®É¶¡
- 2010-4-30
- ³Ì«áµn¿ý
- 2024-11-12
|
¦^´_ 9# 198188
À³¸Ó¬O§Aªº§@¥Î¤¤¤u§@ªí¨Ã«DSheet1
¨º´N¤½¦¡¤º°Ñ·Ó¥[¤W¤u§@ªí- Sub ex()
- Set d = CreateObject("Scripting.Dictionary")
- ay = Array("OBL", "OHC", "CO")
- With Sheets("Sheet1")
- Set Rng = .Range(.[C2], .Cells(.Rows.Count, 3).End(xlUp))
- For Each a In Rng
- If IsEmpty(d(a.Value)) Then
- For i = 9 To 11
- Set rng1 = .Cells(2, i).Resize(Rng.Rows.Count, 1)
- Set rng2 = .Cells(2, i + 6).Resize(Rng.Rows.Count, 1)
- x = Evaluate("SumProduct((" & Rng.Address(, , , 1) & "=" & a & ")*(" & rng1.Address(, , , 1) & "<>""""))") '°Ñ·Ó¦ì§}¥]§t¥~³¡°Ñ·Ó
- y = Evaluate("SumProduct((" & Rng.Address(, , , 1) & "=" & a & ")*(" & rng2.Address(, , , 1) & "<>""""))") '°Ñ·Ó¦ì§}¥]§t¥~³¡°Ñ·Ó
- If x = 0 Xor y = 0 Then mystr = IIf(mystr = "", ay(i - 9), mystr & "," & ay(i - 9))
- Next
- If mystr <> "" Then d(a.Value) = Array(a.Value, a.Offset(, 1).Value, a.Offset(, 2).Value, a.Offset(, 3).Value, mystr) Else d.Remove a.Value
- mystr = ""
- End If
- Next
- End With
- With Sheets("ON HAND")
- .UsedRange.Offset(1).ClearContents
- If d.Count > 0 Then .[A2].Resize(d.Count, 5) = Application.Transpose(Application.Transpose(d.items))
- End With
- End Sub
½Æ»s¥N½X |
|