- 帖子
- 258
- 主題
- 77
- 精華
- 0
- 積分
- 385
- 點名
- 0
- 作業系統
- Win7
- 軟體版本
- Office2010
- 閱讀權限
- 20
- 性別
- 男
- 來自
- Taiwan
- 註冊時間
- 2010-8-8
- 最後登錄
- 2021-1-25
|
2#
發表於 2014-12-19 15:19
| 只看該作者
回復 1# yangjie
試了多遍,還是Try成功了
Dim d As Object, a, b
Set d = CreateObject("Scripting.Dictionary")
wb1.Activate
With Sheets("基本資料")
row1 = .Cells(65536, 7).End(xlUp).Row
If row1 = 1 Then Exit Sub
For i = 2 To .Cells(65536, 7).End(xlUp).Row
If .Cells(i, 7) <> "" Then
d(.Cells(i, 7).Value) = d(.Cells(i, 7).Value) + .Cells(i, 9).Value
End If
Next
End With
a = d.Keys
b = d.Items
If d.count > 0 Then
For i = 0 To d.count - 1
If CLng(a(i)) > 0 And CLng(a(i)) <= 10 Then
Controls("TextBox" & i + 1) = b(i)
End If
Next
End If |
|