- 帖子
- 835
- 主題
- 6
- 精華
- 0
- 積分
- 915
- 點名
- 0
- 作業系統
- Win 10,7
- 軟體版本
- 2019,2013,2003
- 閱讀權限
- 50
- 性別
- 男
- 註冊時間
- 2010-5-3
- 最後登錄
- 2025-7-5
|
樞紐的方式我不會, 所以就試著用比較普通的方式來達成 :
Sub nn()
Dim sStr$, sDate$
Dim iRow%, iI%
Dim vDate
Dim oD As Object
Set oD = CreateObject("Scripting.Dictionary")
iRow = [A65535].End(xlUp).Row
For iI = 2 To iRow
oD(CStr(Cells(iI, 1))) = oD(CStr(Cells(iI, 1))) + Cells(iI, 3)
Next iI
vDate = InputBox("請輸入要查詢的收單日期 : ", "輸入收單日期")
For iI = 2 To iRow
If Trim(CStr(Cells(iI, 4))) = Trim(CStr(vDate)) Then
If sDate <> CStr(Cells(iI, 1)) Then
sStr = sStr + Chr(10) + CStr(Cells(iI, 1)) + " : " + CStr(oD(CStr(Cells(iI, 1))))
sDate = CStr(Cells(iI, 1))
End If
End If
Next iI
MsgBox "收單日期 : " + vDate + " 的數量" + sStr
End Sub |
|