- 帖子
- 4901
- 主題
- 44
- 精華
- 24
- 積分
- 4916
- 點名
- 145
- 作業系統
- Windows 7
- 軟體版本
- Office 20xx
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台北
- 註冊時間
- 2010-4-30
- 最後登錄
- 2025-6-16
               
|
回復 10# FAlonso - Sub Ex()
- On Error Resume Next
- Dim Mystr(), MyCnt()
- i = 1
- Do Until Cells(i, 1) = ""
- If IsError(Application.Match(Cells(i, 1) & "," & Cells(i, 2) & "," & Cells(i, 3) & "," & Cells(i, 4), Mystr, 0)) Then
- ReDim Preserve Mystr(s)
- ReDim Preserve MyCnt(s)
- Mystr(s) = Cells(i, 1) & "," & Cells(i, 2) & "," & Cells(i, 3) & "," & Cells(i, 4)
- MyCnt(s) = Cells(i, 5)
- s = s + 1
- Else
- k = Application.Match(Cells(i, 1) & "," & Cells(i, 2) & "," & Cells(i, 3) & "," & Cells(i, 4), Mystr, 0)
- MyCnt(k) = MyCnt(k - 1) + Cells(i, 5)
- End If
- i = i + 1
- Loop
- For i = 0 To s - 1
- Cells(i + 1, 8).Resize(, 4) = Split(Mystr(i), ",")
- Cells(i + 1, 12) = MyCnt(i)
- Next
- End Sub
複製代碼 |
|