- 帖子
- 5923
- 主題
- 13
- 精華
- 1
- 積分
- 5986
- 點名
- 0
- 作業系統
- win10
- 軟體版本
- Office 2010
- 閱讀權限
- 150
- 性別
- 男
- 來自
- 台灣基隆
- 註冊時間
- 2010-5-1
- 最後登錄
- 2022-1-23
        
|
2#
發表於 2012-7-20 16:32
| 只看該作者
本帖最後由 GBKEE 於 2012-7-20 16:36 編輯
回復 1# av8d
E-H欄沒資料 會跑一整欄 加上條件不去執行- Private Sub UserForm_Initialize()
- Dim d As Object, A
- Set d = CreateObject("Scripting.Dictionary")
- With ActiveSheet
- If .[a2].End(xlDown).Row <> .Rows.Count Then '加上這段判斷有無資料資
- For Each A In .Range("a2", .[a2].End(xlDown))
- d(A.Value) = ""
- Next A
- ComboBox1.List = Application.Transpose(d.keys) '同樣的資料 不要跑3次
- ComboBox9.List = Application.Transpose(d.keys) '同樣的資料 不要跑3次
- ComboBox10.List = Application.Transpose(d.keys) '同樣的資料 不要跑3次
- d.RemoveAll
- End If
- If .[B2].End(xlDown).Row <> .Rows.Count Then
- For Each A In .Range("b2", .[B2].End(xlDown))
- d(A.Value) = ""
- Next A
- ComboBox2.List = Application.Transpose(d.keys)
- d.RemoveAll
- End If
- '
- '
- '
複製代碼 |
|