- 帖子
- 8
- 主題
- 2
- 精華
- 0
- 積分
- 50
- 點名
- 0
- 作業系統
- windows7
- 軟體版本
- office2010
- 閱讀權限
- 20
- 性別
- 男
- 註冊時間
- 2013-9-12
- 最後登錄
- 2014-1-17
|
各位大大好,以下是我到網路上找到其他人設計的下拉式選單
我知道版上已經有許多相關的討論了,我也都看過了,但卻讓我搞得更混亂@_@
我的問題是,如何在表單中所建立的下拉式選單(ComboBox)中,引入第二個工作表的資料,並且出現資料選項,選擇完成後輸入在第一個工作表的表格中
附檔是這位大大所設計的,並且具有我所講的功能
但是我完全看不懂他在程式碼裡寫了什麼,也沒有提到工作表2,卻達到這樣的效果
所以想請教各位指點一下迷津
還是我哪裡看漏掉了~
謝謝各位了
Combobox 二層下拉選單.rar (14.98 KB)
- Private Sub ComboBox1_Change()
- With UserForm1
- IT = "模具編號" & .ComboBox1.Value
- .ComboBox2.RowSource = Names(IT)
- .ComboBox2.ListIndex = 0
- .CommandButton2.SetFocus
- End With
- End Sub
- Private Sub ComboBox2_Change()
- UserForm1.CommandButton2.SetFocus
- End Sub
- Private Sub CommandButton1_Click()
- r = [a65536].End(3).Row + 1
- Cells(r, 1).Value = ComboBox1.Value
- Cells(r, 2).Value = ComboBox2.Value
- End Sub
- Private Sub CommandButton2_Click()
- Unload UserForm1
- End Sub
- Private Sub UserForm_Initialize()
- With UserForm1
- .ComboBox1.RowSource = Names("機台")
- .ComboBox1.ListIndex = 0
- .CommandButton2.SetFocus
- End With
- End Sub
複製代碼 |
|